Nginx URL 规范化和子域
我们有 nginx 位于 apache 前面,并部署了 django。
nginx 有一个 url 规范化规则。所有非 www 网址都将按照以下规则重定向到 www
server {
listen 80;
server_name xyz.com;
rewrite ^/(.*) http://www.xyz.com/$1 permanent;
}
但现在我们需要设置子域。在 xyz 上。但所有子域现在都重定向到 www.xyz.com。可以添加的确切规则是仅将 xyz.com 重定向到 www.xyz.com,而不重定向 abc.xyc.com。
We have nginx sitting in front of apache with django deployed.
nginx has a rule for url canonicalization. All non-www urls are redirected to www with the below rule
server {
listen 80;
server_name xyz.com;
rewrite ^/(.*) http://www.xyz.com/$1 permanent;
}
But now we need to set subdomains. on xyz. But all subdomains are now redirecting to www.xyz.com. What could is the exact rule to be added to redirect only xyz.com to www.xyz.com and not redirect abc.xyc.com.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
类型
Type