这是我的网址: http://www.mychoice.com/apppages.php?type=iphone&title=Best-Audiobooks-100&id=2617
我想像这样重写: www.mychoice.com/app/iphone/Best-Audiobooks-100/2617.html
我正在使用此规则进行重写: RewriteRule ^ app /([^ /] )/([^ /] )/([^ /] *)。html $ category.php?type = $ 1& cat = $ 2& catid = $ 3 [L]
但它不起作用。总是重定向到404
答案 0 :(得分:1)
您忘记为前两个捕获组添加量词+
。
RewriteRule ^app/([^/]+)/([^/]+)/([^/]+)\.html$ category.php?type=$1&cat=$2&catid=$3 [QSA,NC,L]
您还更改了替换网址中的查询参数名称。如果目标URL实际上是
http://www.mychoice.com/apppages.php?type=iphone&title=Best-Audiobooks-100&id=2617
然后RewriteRule
应该是
RewriteRule ^app/([^/]+)/([^/]+)/([^/]+)\.html$ /apppages.php?type=$1&title=$2&id=$3 [QSA,NC,L]