子目录中的.htaccess规则

时间:2013-06-21 18:50:02

标签: php .htaccess

我有一个名为test的文件夹,我可以通过http://domain.com/test访问它。我正在尝试将http://domain.com/test/XXX(XXX =每件事)的每个请求发送到php file

我在test/.htaccess中使用了这个:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /test
RewriteRule ^(.*)$   /control.php?path=$1  [L]
</IfModule>

control.php也位于test文件夹中。但它不起作用,我不知道我犯了哪个规则错误!现在每个http://domain.com/test/XXX个请求都会显示404 not found page

1 个答案:

答案 0 :(得分:1)

试试这段代码:

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /test/

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.*)$ control.php?path=$1  [L]
</IfModule>
相关问题