slawsonb Posted February 15, 2006 Posted February 15, 2006 If I get an SSL cert for basedomain.com do I also need one if I want to use www.basedomain.com too? Thanks, Bruce Quote
TCH-Andy Posted February 15, 2006 Posted February 15, 2006 Yes you would (if you don't want a warning coming up on some browsers), but why not just force the use of basedomain.com rather than allowing www.basedomain.com. Quote
slawsonb Posted February 15, 2006 Author Posted February 15, 2006 How do you force www to the base domain? Bruce Quote
TCH-Rob Posted February 15, 2006 Posted February 15, 2006 One way is an htaccess or cPanel redirect. Quote
TCH-Andy Posted February 15, 2006 Posted February 15, 2006 As Rob says, you need to do a redirect. If you do it in the .htacces file and you wanted to redirect everything then it would be; >rewriteEngine on rewriteCond %{HTTP_HOST} !^tchdomain\.com rewriterule (.*) https://tchdomain.com/$1 [R=301,L] However, it does depend on what else you are doing, and if you want everything on https, etc. etc. Quote
slawsonb Posted February 15, 2006 Author Posted February 15, 2006 I don't everything redirected to https. What would be nice is if I could just force ***** to http://**** and https://www.**** to https://****. I am implementing an osCommerce store and just need https for the account and checkout functions. Thanks, Bruce Quote
TCH-Andy Posted February 15, 2006 Posted February 15, 2006 I haven't tested, but I think it should be; >RewriteEngine On RewriteCond %{SERVER_PORT} =443 RewriteRule ^ https://tchdomain.ext%{REQUEST_URI} [R,L] RewriteCond %{SERVER_PORT} !=443 RewriteRule ^ http://tchdomain.ext%{REQUEST_URI} [R,L] The first will redirect your secure and the second your http. If it doesn't work - shout, and we'll take a closer look. Quote
crippen Posted February 15, 2006 Posted February 15, 2006 Hi Andy, would you know of any htaccess script which would force all domain requests to the shared ssl address? Quote
TCH-Andy Posted February 15, 2006 Posted February 15, 2006 You should be able to do a redirect along the lines of the first example I posted above. Just to check my understanding, you want any request coming in, for any file, to use the shared (not your) SSL ? Quote
crippen Posted February 15, 2006 Posted February 15, 2006 Just to check my understanding, you want any request coming in, for any file, to use the shared (not your) SSL ? I'm not entirely decided but yes this may be a possibility. would the code line then be: >RewriteRule ^ https://server###.tchmachines.com/~username%{REQUEST_URI} [R,L] Quote
slawsonb Posted February 16, 2006 Author Posted February 16, 2006 I haven't tested, but I think it should be; >RewriteEngine On RewriteCond %{SERVER_PORT} =443 RewriteRule ^ https://tchdomain.ext%{REQUEST_URI} [R,L] RewriteCond %{SERVER_PORT} !=443 RewriteRule ^ http://tchdomain.ext%{REQUEST_URI} [R,L] The first will redirect your secure and the second your http. If it doesn't work - shout, and we'll take a closer look. Thanks Andy. I will give this a try when your techs figure out how to install my SSL cert. Bruce Quote
slawsonb Posted February 16, 2006 Author Posted February 16, 2006 Andy, I tried your code but I get a "redirect limit exceded" error. This is what I currently have in .htaccess. I commented out the https stuff as part of my testing. Any ideas? Bruce >RewriteEngine On ###RewriteCond %{SERVER_PORT} =443 ###RewriteRule ^ https://2wheelhobbies.com%{REQUEST_URI} [R,L] RewriteCond %{SERVER_PORT} !=443 RewriteRule ^ http://2wheelhobbies.com%{REQUEST_URI} [R,L] Quote
slawsonb Posted February 16, 2006 Author Posted February 16, 2006 Okay. I think I fixed it. The problem is that the not operator (^) can't have a space after it. Corrected .htaccess >RewriteEngine On RewriteCond %{SERVER_PORT} =443 RewriteRule ^https://tchdomain.ext%{REQUEST_URI} [R,L] RewriteCond %{SERVER_PORT} !=443 RewriteRule ^http://tchdomain.ext%{REQUEST_URI} [R,L] Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.