Forum Moderators: phranque

Message Too Old, No Replies

301 Redirect ?

         

stevenzdf

10:10 am on Jul 4, 2009 (gmt 0)

10+ Year Member



Hi everyone, I would like to share a newbie problem with you all...

When I search my site with "site:domain.com"

there are two search results that both point to the same homepage.

one search result is "www.domain.com" and the other one is "domain.com"

During the making of my site, I had suddenly switched over to wordpress, therefore creating the "www.domain.com" resulting in google with newer site titles and description appearing in the search results (bc i changed them). However, my original (old) template still resides in google results as "domain.com" with the old and original site descriptions and site titles. When I click "cached" for "domain.com" it'll lead me to a snapshot of the old template.

My question for this situation is that when I have my google search results showing me both "domain.com" plus "www.domain.com",and when I click them both, they both lead me to the newest version of my WP site, is that what is supposed to happen? Did I already successfully redirect google from my old homepage to my new one? Or is there something else that I need to do?

Also, what exactly does this .htaccess file tells me? :

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>

Thanks for reading, I would appreciate any answers and comments.

longen

5:36 pm on Jul 4, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You need to choose a canonical: either www or non-www, but not both which is what Google has indexed right now.

You can choose with the new meta tag in the header area:
<link rel="canonical" href="http://www.domain.com/">
or if you want non-www
<link rel="canonical" href="http://domain.com/">

There is an option in Google's Webmaster Tools to specify a canonical.

Best of all is to do a 301 via the .htaccess

I'm not sure what your .htaccess code quoted above does thought it appears to redirect to domain.com/index.htm which is also undesirable.

phranque

6:50 am on Jul 5, 2009 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



you should force a 301 response to permanently redirect the request to the canonical domain.

that .htaccess code checks for existence of the request url as a file or directory and forces a temporary (302) redirect to the index.php script if the requested resource doesn't exist.