2012-08-08 61 views

回答

1

你不能有一个RewriteCond在表达%变量(第二部分)。但是你可以使用一个\1来反向引用同样的比赛,并结合URI和主机,像这样:

RewriteCond %{HTTP_HOST};%{REQUEST_URI} ^([^|]+);/\1 

所以,如果一个请求是由:http://example.com/some_path

  • %{HTTP_HOST};%{REQUEST_URI} = example.com;some_path
  • ^([^|]+)比赛example.com\1!= some_path

如果请求的是由

  • %{HTTP_HOST};%{REQUEST_URI} = example.com;example.com_some_path
  • ^([^|]+)比赛example.com\1example.com_some_path开始
+0

非常感谢匹配,你真棒! – aks 2012-08-09 07:21:46