主域名没问题,但是主域下的子目录怎样做做301
我的网站改了版后,子目录地址全变了,麻烦军哥下,子目录乍样做301啊,百度了好多方法都不行比如: http://www.421351.com/a/mt怎样跳转到http://www.421351.com/cc
http://www.421351.com/a/mv怎样跳转到 http://www.421351.com/mv
麻烦军哥指点下,最好能把代码贴出来,谢谢
以下是我现在用的301代码,主域名能跳
server
{
listen 80;
server_name www.421351.com;
index index.html index.htm index.php;
root/home/wwwroot/hy150;
include dede.conf;
location ~ .*\.(php|php5)?$
{
fastcgi_passunix:/tmp/php-cgi.sock;
fastcgi_index index.php;
include fcgi.conf;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 12h;
}
access_log off;
}
server {
server_name 421351.com qqape.com www.qqape.com text.hy150.com;
rewrite ^(.*) http://www.421351.com$1 permanent;
} 自己顶上 location ~* ^/bbs {
rewrite ^/bbs/(.*)$ https://bbs.vpser.net/$1 permanent;
}
加在server段里,重启nginx就行了 谢谢军哥,我试下
页:
[1]