Forum Moderators: phranque

Message Too Old, No Replies

Unique 301 Issue at Home page

         

CainIV

8:20 pm on Dec 19, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Hello all. I have a somewhat unique issue at the index page of one of my websites.

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

jdMorgan

3:03 pm on Dec 20, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm not sure I understood your question. If the following description sounds like what you want, then try it.

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]

In other words, the check for port 443 is overridden if the requested page is "/" or "".

Jim

CainIV

8:36 pm on Dec 20, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Wow thankyou very much JD. This was EXACTLY What I was looking for.

You rock!