我有我的两个RewriteRules的问题。问题.htaccess(mod_rewrite)。重写规则的doens't正常工作
的.htaccess:
# protect the htaccess file
<files .htaccess>
order allow,deny
deny from all
</files>
RewriteEngine On
Options +FollowSymlinks
Options -Indexes
RewriteBase /test/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^download/([0-9]+)$ download.php?id=$1 [L]
RewriteRule ^(.*)$ index.php?c=view&misc=$1 [B]
如果URL包含下载(一些这样的:mydomain.com/download/9)的第一条规则应该redict这个请求的download.php ID = 9?。但事实并非如此。
的var_dump($ _ GET)显示如下:
array(2) { ["c"]=> string(4) "view" ["misc"]=> string(9) "index.php" } index.php
任何想法?
是的。我正在本地主机和文件夹测试: http:// localhost/test/download/9 但添加第二个规则,然后再试一次。 – daniel 2010-05-24 11:32:29
在这里完美的作品。尝试将前缀test /添加到规则中,看看这是否是问题。为了好玩,我添加了RewriteBase规则,并且在这里不起作用。阅读http://httpd.apache.org/docs/2.0/mod/mod_rewrite.html#rewritebase – 2010-05-24 13:44:23
同时阅读http://stackoverflow.com/questions/704102/how-does-rewritebase-work-in-htaccess – 2010-05-24 13:46:46