代码之家  ›  专栏  ›  技术社区  ›  GeoffreyF67

这个apache url htaccess重写规则有什么问题?

  •  0
  • GeoffreyF67  · 技术社区  · 15 年前

    我得到了这个:

    RewriteEngine On
    RewriteRule ^/redir?url=(.*)$ http://blah.$1
    

    当我使用这个并转到如下的URL时:

    http://www.mydomain.com/redir?url=www.otherdomain.com
    

    它说在我的服务器上找不到文件。也就是说,没有重定向。

    在上面的示例中,我希望它能够重定向到:

    http://blah.www.otherdomain.com
    
    1 回复  |  直到 14 年前
        1
  •  2
  •   Wrikken    15 年前

    rewriterules不适用于querystrings,rewritesecond的作用是:

    RewriteCond %{QUERY_STRING} url=([^&]+)(&|$)
    RewriteRule ^/?redir$ http://blah.%1