Htaccess和重写规则

时间:2013-04-15 20:01:15

标签: php .htaccess rewrite

我在.htaccess文件中有这个:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /test/
RewriteCond %{REQUEST_URI} !(panel/index.php)
RewriteRule ^panel/(.*)$    panel/index.php/$1/ [L]
</IfModule>

我想将包含panel/(.*)的所有链接隧道传输到panel/index.php以进行控制。

以上规则有效,除非网址为http://localhost/test/panel/!它重定向到:

http://localhost/test/panel/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/index.php/

需要帮助。

1 个答案:

答案 0 :(得分:1)

试试这个

 <IfModule mod_rewrite.c>
    RewriteEngine On
    #skip rewrite for  index.php
    RewriteRule ^panel/index.php(.*)$ - [S=1,L]
    RewriteRule ^panel/(.*)$    panel/index.php/$1/ [L]
 </IfModule>