【发布时间】:2025-12-10 00:20:05
【问题描述】:
我的两个 RewriteRules 有问题。
.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),第一条规则应该将此请求改写为 download.php?id=9。但事实并非如此。
var_dump($_GET) 显示如下:
array(2) { ["c"]=> string(4) "view" ["misc"]=> string(9) "index.php" } index.php
有什么想法吗?
【问题讨论】:
标签: .htaccess mod-rewrite