How to redirect 301:
/cgi-bin/mt/mt-search.cgi?search=WORDS
to
/?s=WORDS
in .htaccess
file?
How to redirect 301:
/cgi-bin/mt/mt-search.cgi?search=WORDS
to
https://example/?s=WORDS
in .htaccess
file?
1 Answer
Reset to default 0Try something like the following at the top of your root .htaccess
file (before the WordPress block):
RewriteCond %{QUERY_STRING} ^search=([^&]*)
RewriteRule ^cgi-bin/mt/mt-search\.cgi$ /?s=%1 [R=301,L]
%1
in the RewriteRule
substitution is a backreference to the captured group in the preceding CondPattern (ie. the value of the search URL parameter - "WORDS").
Clear your browser cache before testing.
It is preferable to first test with a 302 (temporary) redirect to avoid caching issues.
Reference:
https://httpd.apache/docs/current/mod/mod_rewrite.html