求助关于.htaccess正则的问题

2025-05-13 20:23:15
推荐回答(1个)
回答1:

1、把/v/item.php?type=$1\&id=$2\&p=$3 里的转义\都去掉,没必要。
2、【核心错误】RewriteRule是不包含querystring部分的,即问号之后的部分,如果想对这部分进行rewrite,需要用到RewriteConds。

RewriteConds %{QUERY_STRING} p=([^&]*)
RewriteRule ^list/(.*)-(.*).htm /v/item.php?type=$1&id=$2&p=%1 [L]