Please help me need redirect search.html?searchword=value&searchphrase=all
to search.html?searchword=value
I tried:
RewriteCond %{QUERY_STRING} ^searchword=(.*) [NC]
RewriteCond %{QUERY_STRING} searchphrase= [NC]
RewriteRule ^(.*)$ /search.html?searchword=%1 [R=301,L]
but it do not work.
2
Answers
With your shown samples and attempts please try following .htaccess rules. Please make sure to clear your browser cache before testing your URLs.
You may use it like this:
Changes are:
RewriteCond
is important. Keep the condition with capture group as last onesearchword
again in target, just capture fromRewriteCond
and use it later as back-reference%1
.*
use[^&]*
to match only value till you get next&
or end of stringsearch.html
in rule pattern to avoid matching anything else