我缺少哪个重写规则(IIS 上的 ISAPI)?
我有以下规则:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.example\.com$
RewriteRule ^blog/?$ http://blog.example.com/ [P]
RewriteRule ^(blog/.*)$ http://blog.example.com/$1 [p]
RewriteCond %{HTTP_HOST} ^example.com$
RewriteRule ^(.*)?$ http://www.example.com/$1 [L,R=301]
我想要实现的目标是,任何对 http://www.example.com/blog 代理到 http://blog。 example.com。 我这里遇到的问题是,如果我访问 http://blog.example.com/ some/dir/foo.php 它工作正常。 但是,如果我转到 http://www.example.com/blog/ some/dir/foo.php,它不起作用。
我缺少什么规则?
I have the following rules:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www\.example\.com$
RewriteRule ^blog/?$ http://blog.example.com/ [P]
RewriteRule ^(blog/.*)$ http://blog.example.com/$1 [p]
RewriteCond %{HTTP_HOST} ^example.com$
RewriteRule ^(.*)?$ http://www.example.com/$1 [L,R=301]
What I'm trying to achieve, and it works up to 90% of my expectations, is that any hits to http://www.example.com/blog proxies over to http://blog.example.com. The issue I have here is that if I visit http://blog.example.com/some/dir/foo.php it works fine. However, if I go to http://www.example.com/blog/some/dir/foo.php, it does NOT work.
What rule am I missing?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试用此规则替换前两条规则:
Try replacing the first two rules by this rule: