RewriteEngine OnRewriteCond %{REQUEST_URI} ^/abc
RewriteRule .* test1/index.phpRewriteRule .* test/index.php不是相当于下的例子吗?
if($_SERVER['REQUEST_URI']=='/abc'){
header("location:test1/index.php");
}else{
header("location:test/index.php");
}为什么正规式,不起作用呢?非常疑惑~~~~~~~~~~~~~

解决方案 »

  1.   

    无论怎么输入xxx.com/abc,都去了test/index.php
    不能去test1/index.php
      

  2.   

    RewriteRule .* test1/index.php
    .*表示所有的,都转走了。就不会执行下一行了
    RewriteRule .* test/index.php
      

  3.   

    试试这个:
    RewriteCond %{REQUEST_URI} ^/abc
    RewriteRule .* test1/index.php
    RewriteCond %{REQUEST_URI} !^/abc
    RewriteRule .* test/index.php