tags:

views:

33

answers:

2

old domain link:

http://www.old.com/aa/bb/cc.html

i want when this old link to be visiting,turn to:

http://www.new.com/aa/bb/cc.html

how to do this?

BTW: nginx or apache

+2  A: 

Create a .htaccess file similar to the following and place it to the old domain root directory.

RewriteEngine On
RewriteRule ^(.*)$ http://www.new.com/$1 [R=301,QSA]
Jan Kuča
A: 

For nginx I go with this on account that it also helps with alias domains.

if ($host != 'www.new.com' ) {
    rewrite  ^/(.*)$  http://www.new.com/$1 permanent;
}
intlect