wordpress - 301 redirect with query string - woocommerce products -
here problem i've stalled days. setup wordpress woocommerce installed. permalinks structure works great, need redirect old urls new ones.
old url structure looks this: http://domain.tld/?product=bla-bla
but need them redirect this: http://domain.tld/product/bla-bla
*bla-bla dynamic part.
the rule in .htaccess i've made:
rewritecond %{query_string} ^product=(.*)$ [nc] rewriterule ^$ /product/%1 [nc,l,r=301]
but result partially wrong: http://domain.tld/product/bla-bla?product=bla-bla
the contents of .htaccess:
rewriteengine on rewritebase / rewriterule ^index\.php$ - [l] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule . /index.php [l] rewritecond %{query_string} ^product=(.*)$ [nc] rewriterule ^$ /product/%1 [nc,l,r=301]
i appreciate help!
have way:
rewriteengine on rewritebase / rewritecond %{query_string} ^product=(.*)$ [nc] rewriterule ^$ /product/%1? [nc,l,r=301] rewriterule ^index\.php$ - [l] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule . /index.php [l]
?
@ end of target strip off query string original url.
Comments
Post a Comment