Reputation: 77
I recently did an overhaul of a website in which we switched to a new master domain name for that website. The old domain is still active, and needed to be redirected to the new domain name.
The site still has the same root folder, and so there are a couple of files that were updated, but have the same name (i.e. index.php, about.php, contact.php).
I manually redirected all the files (via .htaccess) that no longer exist to new files with a manual redirect:
redirect 301 /old_file.php http://www.new_domain.org/new_file.php
However this will not work with the files that have the same name such as "index.php". I can still call the site by the old domain name. How do I properly refer these files so that I don't have a duplicate penalty from google?
I tried this and it did not work:
#Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.old_domain.org$[OR]
RewriteCond %{HTTP_HOST} ^old_domain.org$
RewriteRule ^(.*)$ http://www.new_domain.org/$1 [R=301,L]
Thank You
Upvotes: 2
Views: 1499
Reputation: 114417
Take a look at using the canonical tag as an alternative.
http://www.seomoz.org/blog/cross-domain-canonical-the-new-301-whiteboard-friday
Upvotes: 1
Reputation: 785571
httpd.conf
and then put this code in your .htaccess
under DOCUMENT_ROOT
directory:Code
Options +FollowSymLinks -MultiViews
# Turn mod_rewrite on
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} ^(www\.)?old_domain\.org$ [NC]
RewriteRule ^ http://www.new_domain.org%{REQUEST_URI} [R=301,L]
Upvotes: 6