重写.htaccess中的规则问题

时间:2014-01-15 22:33:34

标签: apache .htaccess mod-rewrite url-rewriting

我真的很担心这些Rewriterules

1. RewriteRule ^category/([^/.]+)/([^/.]+)/([^/.]+)/?$ category.php?id=$1&cat=$2&page=$3   [QSA]
2. RewriteRule ^article/([^/.]+)/([^/.]+)/?$ article.php?id=$1&name=$2 [QSA]

3. RewriteRule ^search/([^/.]+)/([^/.]+)/?$ search.php?search=$1&page=$2 [QSA]

他们加载

..domain.comcategory/...

..domain.comarticle/....

..domain.comsearch/....

而不是(例如).COM和CATEGORY之间的SLASH / 我的意思是

..domain.com/category/...

..domain.com/article/....

..domain.com/search/....

如果手动插入斜杠(/),它们都会加载页面。

1 个答案:

答案 0 :(得分:0)

尝试输入缺少的初始斜杠。例如:

RewriteRule ^category/([^/.]+)/([^/.]+)/([^/.]+)/?$ /category.php?id=$1&cat=$2&page=$3 [QSA]