网址重写不适用于.htaccess中的网页

时间:2015-11-17 20:35:09

标签: .htaccess mod-rewrite

我有一个带get方法的html表单,操作页面是write.php。我已经重写了htaccess中的url,但它显示未找到。我的表格低于 -

<form method="GET" action="http://localhost/dsbd/review/write" id="rateForm">
   <input id="rating-1" data-index="1" class='brating' name="rating" value="1" type="radio" data-toggle="tooltip" data-placement="top" title="1 (Eek! Methinks not.)"  onclick="document.getElementById('rateForm').submit();">
   <input id="rating-2" data-index="2" class='brating' name="rating" value="2" type="radio" data-toggle="tooltip" data-placement="top" title="2 (Eek! Methinks not.)"  onclick="document.getElementById('rateForm').submit();">
</form>

和htaccess -

RewriteEngine On
RewriteRule   ^.+/p/([0-9]+)   product.php?id=$1    [QSA,L]
RewriteRule   ^.+/c/([0-9]+)   category.php?id=$1    [QSA,L]
RewriteRule   ^.+/c/all/([0-9]+)   category-all.php?id=$1    [QSA,L]
RewriteRule   ^.+/b/([0-9]+)   business.php?id=$1    [QSA,L]
RewriteRule   ^.+/review/([0-9]+)   write.php?id=$1    [QSA,L]

请忽略前5条规则。它们用于其他页面并且工作正常。

感谢。

1 个答案:

答案 0 :(得分:0)

将最后一行更改为

RewriteRule   ^.+/review/(.+)   dsbd/write.php?id=$1    [QSA,L]