问题:
www.xx.com/list/zhagnsan.html
重定向到
zhagnsan.xx.com
www.xx.com/list/lisi.html
重定向到
lisi.xx.com
list目录下的内容都重定向到对应的二级域名!!!
问题:
www.xx.com/list/zhagnsan.html
重定向到
zhagnsan.xx.com
www.xx.com/list/lisi.html
重定向到
lisi.xx.com
list目录下的内容都重定向到对应的二级域名!!!
重定向用return
就可以了
server {
server_name www.example.com;
location ~ /list/([a-zA-Z0-9]+)\.html$ {
return 301 http://$1.example.com/;
}
}
二级域名的默认首页可以用正则捕获并配合try_files
server {
server_name ~^(\w+)\.example\.com$;
root /home/www/list/;
index index.html;
location /{
try_files $1.html $uri;
}
}
15 回答8.3k 阅读
2 回答2.4k 阅读✓ 已解决
1 回答1.8k 阅读✓ 已解决
1 回答1.1k 阅读✓ 已解决
3 回答850 阅读
1 回答770 阅读
1 回答563 阅读
重新理解下你的意思: