Google is indexing my servers IP address, causing duplicate content issues. I want to redirect the IP address to the domain, but preserve the URL path. I have tried this, but it redirects all URL’s with the IP address to the homepage:
RewriteCond %{HTTP_HOST} ^[0-9]+(\.[0-9]+){3}$ [OR]
RewriteCond %{HTTP_HOST} !^www\.ridepros\.com$ [OR]
RewriteCond %{HTTP_HOST} ^ridepros.com$ [NC]
RewriteRule ^(.*)$ http://www.ridepros.com/$1 [L,R=301]
I would prefer to redirect the user to the correct URL, not the homepage. I’ve tried this, but I get server 500 errors when I paste it into the HTaccess file:
RewriteCond %{HTTP_HOST} !208\.113\.243\.229\(?<silo>[a-zA-Z_0-9]+\W*\S*)
RewriteRule (.*) http://www.ridepros.com/$1
Any suggestions on how to fix this?
Just for reference, I found this in a Webmaster World thread, it fixed my issue..
http://www.webmasterworld.com/google/3390524.htm