Forum Moderators: phranque

Message Too Old, No Replies

implemented a 301 redirect with weird results

         

tom12c

4:37 pm on Jun 24, 2010 (gmt 0)

10+ Year Member



I implemented a 301 redirect on my site that I thought would solve my problems (which they did to an extent), unfortunately other things occurred which I'd like to fix too.

Someone from this site was very helpful in providing this apache/htaccess code for me. (Thanks again!)

RewriteEngine On
RewriteCond %{HTTP_HOST} !^(www\.example\.com)?$
RewriteCond %{SERVER_PORT}s ^(443(s)|[0-9]+s)$
RewriteRule ^(.*)$ http$2://www.example.com/$1 [R=301,L]

Background:

There are quite a few domains pointing to my site. There is the main one, and quite a few others.

It appeared that some of these other domains were starting to appear in google search results.

Function of code above:

For those who don't know, the code I display above means if you access the site for another domain, the domain will be redirected to the main one (www.example.com).

IE. Access the site with www.example1.com or www.example2.com (etc), it will redirect 301 you to www.example.com.

Unfortunately, it also seems to of messed with the search results. Either google is having an off couple of weeks with indexing, or something else needs to be tweaked in the code. The other domains are now appearing more frequently in the google search results and that didn't happen before. I would prefer if they did not show up at all.

Would anyone be able to provide assistance?

tom12c

4:41 pm on Jun 24, 2010 (gmt 0)

10+ Year Member



edit: can't seem to find the edit functionality on here.

One line should read:

For those who don't know, the code I display above means if you access the site from another domain, the domain will be redirected to the main one (www.example.com).

g1smd

7:12 am on Jun 25, 2010 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



It can take a year for search listings to be fixed - however that is not a problem.

Any clicks on the "wrong" URLs will be correctly redirected to the correct location by your redirect.