Nginx.
Original URL:
http://www.domain name.com/news/aaa.html
http://www.domain name.com/product/aaa/bbb/xxx.html
It is necessary to redirect the web pages in the two directories /news/ and /product/ to the following URL:
http://www.domain name.com/old/news/aaa.html
http://www.domain name.com/old/product/aaa/bbb/xxx.html
大家讲道理2017-05-16 17:24:58
rewrite ^/(news|product)/(.*)$ /old// permanent last;
Put it in the server block. Just written it casually, not tested.
天蓬老师2017-05-16 17:24:58
server {
server_name www.xxx.com xxx.com;
if ($host != 'www.xxx.com' ) {
rewrite ^/(.*)$ http://www.xxx.com/ permanent;
}
}
The key is permanent
Subdirectory jump:
location ~* ^/news/ {
rewrite ^/news/(.*)$ http://www.xxx.com/old/news/ permanent;
}