I have some pages in Google which start with the IP address (not the URL) and this presents a problem with duplicate pages.
If any of the examples below are typed in then they all go to http://www.example.com
Options +FollowSymLinks
RewriteEngine on
# Redirect all requests for listed non-canonical domains to same page in www.example.com
RewriteCond %{HTTP_HOST} ^example\.com [OR]
RewriteCond %{HTTP_HOST} ^127\.0\.0\.1 [OR]
RewriteCond %{HTTP_HOST} ^dns1.example\.com [OR]
RewriteCond %{HTTP_HOST} ^dns2.example\.com
RewriteRule (.*) http://www.example.com/$1 [R=301,L]
The problem is with the following:-
http:
//127.0.0.1/acatalog/album/Trentan%20Timber%20Buildings/
should be http://example.com/acatalog/album/Trentan%20Timber%20Buildings/
Normally a redirect as follows would redirect all pages to the correct folders:-
RewriteEngine on
RewriteBase /
RewriteRule ^acatalog/album/(.*) http://www.example.com/acatalog/album/ [R=301,L]
but this does not work. Is this because of the IP address at being the start of the URL?
I've also tried this, as well as other combinations, and does not work:-
RewriteEngine On
RewriteCond %{HTTP_HOST} ^127.0.0.1/acatalog/album/$
RewriteRule (.*) http://www.example.com/acatalog/album$1 [R=301,L]
Can anyone help with this problem? I can't seem to find anything about redirecting folders from an IP address to the correct URL address which makes sense or works for me. Thank you.
[edited by: incrediBILL at 9:18 am (utc) on Aug 28, 2012]
[edit reason] IP removed, no specifics please, unlinked URL [/edit]