【问题标题】:Which rewrite rule am I missing(ISAPI on IIS)?我缺少哪个重写规则(IIS 上的 ISAPI)?
【发布时间】:2010-10-09 08:24:47
【问题描述】:

我有以下规则:

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 进行代理,并且它可以达到我预期的90%。我在这里遇到的问题是,如果我访问 http://blog.example.com/some/dir/foo.php 它工作正常。但是,如果我去http://www.example.com/blog/some/dir/foo.php,它就不起作用。

我错过了什么规则?

【问题讨论】:

    标签: http iis mod-rewrite webserver isapi


    【解决方案1】:

    尝试用这条规则替换前两条规则:

    RewriteCond %{HTTP_HOST} ^www\.example\.com$
    RewriteRule ^blog/(.*) http://blog.example.com/$1 [P]
    

    【讨论】:

    • 不幸的是,这似乎没有做到这一点
    猜你喜欢
    • 2013-12-01
    • 1970-01-01
    • 2010-10-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-02-12
    • 1970-01-01
    相关资源
    最近更新 更多