PDA

View Full Version : Best way to Redirect a domain name?



MarkB
05-09-2005, 04:30 AM
Hi guys,

I'm currently redirecting a domain name using an Apache rewrite, so all URLs link to, for example, www.olddomain.com/somefile.html will be redirected to www.newdomain.com/somefile.html

This is the Apache rewrite I'm using (in httpd.conf):



ServerName olddomain.com
ServerAlias www.olddomain.com
RewriteEngine on
RewriteRule ^/(.*) http://www.newdomain.com/$1 [L,R]


However, Google is not updating with this change, and actually still indexing the old URL with the new content!!

Any ideas of the best way to migrate domains, but keep direct links still operational?

Mark

piniyini
05-09-2005, 09:39 AM
I'm no expert with htaccess, but if I were you I would try


[R=301,L]

instead of


[L,R]

Dan Morgan
05-09-2005, 11:13 AM
As mentioned a 301 redirect is the correct way of telling the search engines the page has permanently moved. This is how I do it in .htaccess (I think someone from these boards gave me this in an earlier thread - what are the odds).



# olddomain.com/anything www.olddomain.com/anything anything.olddomain.com/anything
# every.sub.domain.olddomain.com/anything
RewriteCond %{HTTP_HOST} ^(.*)olddomain\.com$ [NC]
# will be redirected to www.newdomain.com/anything
RewriteRule ^.*$ http://www.newdomain.com%{REQUEST_URI} [R=301,L]



Original thread here - http://www.websitepublisher.net/forums/search.php?searchid=23934

MarkB
05-09-2005, 12:04 PM
Cheers guys - will try that tomorrow.

Todd W
05-18-2005, 05:05 PM
Yep! 301 - The search engines will then know where to go in the future.