修改一些重写规则

时间:2012-12-06 18:52:27

标签: .htaccess mod-rewrite

我有以下重写规则:

RewriteRule ^section/(.*)/(.*)_(.*).html$ index.php?section_permalink=$1&content_permalink=$2&content_id=$3 [QSA,L]
RewriteRule ^section/(.*)/page_(.*)/$ index.php?section_permalink=$1&page=$2 [QSA,L]
RewriteRule ^section/(.*)/$ index.php?section_permalink=$1 [QSA,L]

我想修改它们以摆脱/ section /。

我该怎么做?

谢谢!

1 个答案:

答案 0 :(得分:1)

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]

RewriteRule ^(.*)/(.*)_(.*).html$ index.php?section_permalink=$1&content_permalink=$2&content_id=$3 [QSA,L]
RewriteRule ^(.*)/page_(.*)/$ index.php?section_permalink=$1&page=$2 [QSA,L]
RewriteRule ^(.*)/$ index.php?section_permalink=$1 [QSA,L]