简体   繁体   中英

Apache redirect without querystring?

Here is my apache rewriterule:

RewriteCond %{QUERY_STRING} cate_id\=(\d+)
RewriteRule ^cate.php$ category-%1-b0.html [R=301,L]

And I want to redirect cate.php?cate_id=72 to category-72-b0.html , but it redirect to category-72-b0.html?cate_2=72 , I don't want the querystring after .html , is there anyway to remove it?

尝试:

RewriteRule ^cate.php/.*$ category-%1-b0.html? [R=301,L]

Try this: Notice the "?" at the end of the RewriteRule.

RewriteEngine On
RewriteCond %{QUERY_STRING} cate_id\=(\d+)
RewriteRule ^cate.php$ category-%1-b0.html? [R=301,L]

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM