Forum Moderators: phranque
I use a 301 via htaccess to rewrite all pages from non www to www. The only exception is that I block https:// pages from this effect as they must stay non www to be secure.
RewriteEngine On
RewriteCond %{HTTP_HOST} ^site\.com
RewriteCond %{SERVER_PORT}!443
RewriteRule (.*) [site.com...] [R=301,L]
My issue is this. Somehow my index site is listed in google in this format now: [site.com...]
There are no relative links from our shopping cart (where the https:// is called) to the root and yet this appears in index.
Is there a way to disallow the [site.com...] in the htaccess directly to avoid this issue as we do not ever need to call https:// at the root?
Thanks
The following modified code will redirect non-https requests for "example.com/<anything>" to "www.example.com/<anything>" as it did previously, but should also redirect requests for "example.com" or "example.com/" via either http or https to "www.example.com/":
RewriteEngine On
RewriteCond %{HTTP_HOST} ^example\.com
RewriteCond %{REQUEST_URI} ^/?$ [OR]
RewriteCond %{SERVER_PORT} !443
RewriteRule (.*) http://www.example.com/$1 [R=301,L]
Jim