apache - htaccess 301 redirect rule for multiple query strings -
i want 301 redirect rule multiple query string make seo friendly url.
internal url: www.example.com?p=54&p1=abc xyz&p2=xxx45767
, on.
301 redirect url: www.example.com/54-abc-xyz-xxx45767?p=54&p1=abc xyz&p2=xxx45767
so, redirect url must contain old query parameters too.
first step check query_string
parameters in question. if match found, redirect should occur.
you can use following in /.htaccess
file:
rewriteengine on # check query string , capture parts rewritecond %{query_string} ^p=([^&]+)&p1=([^&]+)&p2=([^&]+)$ # if @ root of domain, redirect rewriterule ^$ /%1-%2-%3 [r=302,l]
to make redirect permanent , cached browsers , search engines, change 302
301
.
Comments
Post a Comment