I've got an SSL on my e-commerce site and rather than hassle with transferring data to SSL when customers checkout I simply want to run it on
https:// all the time. There isn't much data on the site so it's not going to cause any bad delays. Therefore, I just want to make sure that anybody that hits the site gets switched over to
https:// if they didn't hit it directly.
Also, I've read that in order to help search engines you should decide whether you want to use domain.com or
www.domain.com and then add a 301 permanent redirect on the other one. I want to do that anyway because my SSL is setup for
www.domain.com and when you don't include
www. you get an SSL warning/error.
I'm trying to do this with my .htaccess file in my web root. I tried the following on my own:
RewriteEngine On
RewriteCond %{http_host} ^usbswiper.com [nc]
RewriteRule ^(.*)$
https://www.usbswiper.com/$1 [r=301,nc]
RewriteCond %{HTTPS} off
RewriteRule (.*)
https://%{HTTP_HOST}%{REQU
EST_URI}
When I do that only the part that takes you to
https:// works. If I type mydomain.com into a browser without www in front of it I get an SSL error (my SSL is for
www.domain.com).
If I use either of those by themselves I get what's expected out of that particular rule. So if I take the https rule out and leve the other one it will indeed send me to
www.domain.com when I don't include the
www.
At that point I asked my web host if they could help. They wound up editing the .htaccess file as follows:
RewriteEngine On
#RewriteCond %{http_host} ^usbswiper.com [nc]
#RewriteRule ^(.*)$
https://www.usbswiper.com/$1 [r=301,nc]
RewriteCond %{HTTPS} off
RewriteRule (.*)
https:///www.usbswiper.com/$1 [r=301,nc]
After they did this everything seems to work perfectly for me exactly how I want so I thought all was well. However, I've started to get numerous complaints that my web site won't load at all for people. They just get page not found as if the site doesn't exist. I've heard this from quite a few people since they made that change for me, but again, everything seems to work just fine for me.
In fact, to add some more info, I used to have this site setup within a sub-directory of another domain. Search engines indexed the pages on that domain and as such that domain still shows up in search results. I added a PHP 301 redirect into these pages on the previous domain and when people go through that original site they get redirected successfully and the new domain loads correctly. When they go directly to the site, though, they get page not found.
So something about this .htaccess is screwing things up for only for some people.
Any information on how I can make this work 100% would be greatly appreciated. Thanks!
Start Free Trial