域名跳转就是当你访问老域名时会自动跳转到新域名上面,因为你的老客户可能不知道你换域名了,他还会访问你的老域名,这样的话若不做跳转他就访问不到,他就会认为你的网站出毛病了,很可能失去一个老客户,所以我们在用新域名的同时,老域名也不要丢掉,做下跳转就ok了。下面是按照我自己的做的,视情况而定 把老站停掉 这里依自己的配置文件实际目录而定,我这里是按照自己的,配置文件目录/usr/local/nginx/conf/vhost 网站目录 /webdata/data/yungui.com # cd /usr/local/nginx/conf/vhost # mv yungui.conf yungui.conf.bak # /etc/init.d/nginx reload # /usr/local/nginx/sbin/nginx -t # vim yungui.conf.bak 修改配置文件 server { listen 192.168.0.12:80; server_name www.hehuan.com; index index.html index.htm index.php; root /webdata/data/yungui.com/; if (!-e $request_filename) { rewrite ^(.+)$ /index.php last; } location ~ .*\.(php|php5)?$ { try_files $uri =404; fastcgi_pass unix:/tmp/php-cgi.sock; fastcgi_index index.php; include fcgi.conf; } location /status { stub_status on; access_log off; } location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ { expires 30d; } location ~ .*\.(js|css)?$ { expires 12h; } access_log /home/wwwlogs/access.log access; } #2 301 server { listen 192.168.0.12:80; server_name yungui.com www.yungui.com hehuan.com; rewrite ^/(.*) http://www.hehuan.com/$1 permanent; } server { listen 192.168.0.12:80 default; server_name _; return 404; } 数据库导出 # cd /webdata/data/yungui.com/app/etc/ # cat local.xml 这个文件中有用户名、数据库名、密码 # mysqldump -hlocalhost -umagento -p magento01 > my0709.sql # vim my.sql %s/yungui.com/hehuan.com/g :wq 导入 # mysql -hlocalhost -u magento -p 数据库名(magento01)< my0709.sql # cd /webdata/data/yungui.com/var/ # rm -rf session/* cache/* # cd /usr/local/nginx/conf/vhost # mv yungui.conf.bak yungui.conf # /etc/init.d/nginx restart