I want to do a 301 redirect for all urls with a query string to the base url (without the query string).
For example:
http://www.mysite.com/directory/abcbd.html?q1=23&q2=89 should be redirected to http://www.mysite.com/directory/abcbd.html
As shown in the above examples "q1=" will ALWAYS appear in the beginning in the urls in question. The next set of urls could vary. So is there something like: RewriteCond %{query_string} "q1=.*" - not good at these things!
What entries do I need to enter in the .htaccess file?
Thanks, Sameer
Actually I got it done using the wp_redirect plugin.
source: /(. )/(. ).html(. )\\?dontneedthisstring=(. ) target: /$1/$2.html
This cleans it up.
Here "dontneedthisstring" was the uniq string i was trying to get rid of.
我会用以下规则做到这一点:
RewriteRule ^(.*)\?.* $1 [L,R=301]
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.