84669 人学习
152542 人学习
20005 人学习
5487 人学习
7821 人学习
359900 人学习
3350 人学习
180660 人学习
48569 人学习
18603 人学习
40936 人学习
1549 人学习
1183 人学习
32909 人学习
Nginx. 原来的URL:http://www.域名.com/news/aaa.htmlhttp://www.域名.com/product/aaa/bbb/xxx.html 需要把 /news/和/product/这2个目录下的网页重定向到以下URL:http://www.域名.com/old/news/aaa.htmlhttp://www.域名.com/old/product/aaa/bbb/xxx.html
rewrite ^/(news|product)/(.*)$ /old// permanent last;
放server块里。随手写的,没测试。
server { server_name www.xxx.com xxx.com; if ($host != 'www.xxx.com' ) { rewrite ^/(.*)$ http://www.xxx.com/ permanent; } }
关键在 permanent
permanent
子目录跳转:
location ~* ^/news/ { rewrite ^/news/(.*)$ http://www.xxx.com/old/news/ permanent; }
重写
放server块里。随手写的,没测试。
关键在
permanent
子目录跳转:
重写