开发者

how do i get mod_rewrite to execute the RewriteRules if and only if there is no parameter q= in the url?

the below code works to deal with my url structures but i need the rules not to work if there is parameter q= in the url.

i tried to set up a rewritecond (in the commented out line below) without success,

please help! thanks :)

Options +FollowSymlinks
RewriteEngine on

# RewriteCond %{QUERY_STRING} q!=(.*)
RewriteRule ^FSD/([^/]+)/([^/]+)/ /index.php?service=$1&type=FSD [NC]
RewriteRule ^ECD/([^/]+)/([^/]+)/ /index.php?service=$1&type=ECD [NC]
RewriteRule ^([^/]+)/([^/]+)/ /index.php?category=$1&subcategory=$2 [NC]
RewriteRule ^([^/]开发者_如何转开发+)/ /index.php?category=$1 [NC]


Your RewriteCond's test pattern is a little off, but you got the right idea:

RewriteCond %{QUERY_STRING} !(\A|&)q=.*

Note that the RewriteCond only applies to the next RewriteRule, so if you want to perform this exclusion for all four of your rules, you'll need to copy the RewriteCond above each of them.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜