Reputation: 449
My client is changing his domain, and I'm curious about the best way to make all the existing links on other sites work, so that:
redirect automatically to:
Is there a way to set it up so that all the old links simply correspond to the exact same structure, simply with a new domain?
Thanks!
Upvotes: 1
Views: 34
Reputation: 4427
To the best of my knowledge you would have to keep the old domain and redirect from there with '301's in an .htaccess file or something similar.
An example .htaccess file might look like this:
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !newdomain.com$ [NC]
RewriteRule ^(.*)$ http://www.newdomain.com/$1 [L,R=301]
Or:
RewriteEngine On
RewriteBase /
Redirect 301 /dir/ http://www.newdomain.com/dir/
Redirect 301 /dir/file.html http://www.newdomain.com/dir/file.html
I suggest you read up on 301 Redirects and .htaccess files. This .htaccess generator might also be of use to you.
Upvotes: 1