nginx子域重写
我需要一个 nginx 重写规则来重写:
http://some-keyword.example.com
到 www.example.com/keyword.php?keyword=$some-keyword
而前面没有 www
的域名仍会重写为 www.example.com
并且 www
不会被视为关键字。
请你帮我解决这个问题,这两条规则如何写?
I need a nginx rewrite rule to rewrite from:
http://some-keyword.example.com
to www.example.com/keyword.php?keyword=$some-keyword
while domain without www
in front still rewrites to www.example.com
and www
isn't taken as a keyword.
Please could you help me to solve this problem, how to write these two rules?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果您指的是重定向,那么:
在重写的情况下,只需执行以下操作即可
If you meant redirect, then:
In the case of rewrite then simply do
如果可能的话,我只创建 1 个服务器(虚拟主机),即普通的
domain.com
/www.domain.com
,然后使用 conf 重写其余部分 他们。如果我错过了什么,请告诉
If it's possible I'd only create 1 server(virtual host) which is the normal
domain.com
/www.domain.com
and then use the conf to rewrite the rest to themplease tell me if I missed something.