我的目标是重写
http://domain.com/subdir/index.php?p=page-title
作为
http://domain.com/subdir/page-title
下面的代码看起来正确,但我找到了404 Not Found?
RewriteEngine on
RewriteRule ^/subdir/([^/.]+)/?$ /subdir/index.php?p=$1 [L]
答案 0 :(得分:1)
请删除规则中的前导斜杠(假设它位于.htaccess
而不是httpd.conf
)
RewriteEngine on
RewriteRule ^subdir/([^/.]+)/?$ /subdir/index.php?p=$1 [NC,QSA,L]