Trying to change
https://www.example.com/search/label/my%20search%20term
to
https://www.example.com/tag/my-search-term
Per the answer from @anubhava below, Option 2 works:
RewriteEngine On
RewriteRule ^search/label/(S+)[-s]+(S+)$ /tag/$1-$2 [NE,NC,L,R=301]
RewriteRule ^search/label/(S+)$ /tag/$1 [NE,NC,L,R=301]
RewriteRule ^(search/label/S+)s+(S+s.*)$ /$1-$2 [NC,L]
Thanks!
2
Answers
Could you please try following, written as per shown samples. Please make sure you clear your browser cache before testing your URLs.
OR using
S
here: Please make sure either you put above rules OR following rules only one at a time.You may try these recursive rules in your site root .htaccess:
Option 1:
Option 2: