apache - htaccess rule to remove parameters -
struggling come .htaccess rule remove parameters it. want
to rewrite
http://www.example.com/page/competition.html
so, right /page/compeition.html rewritten. grateful assistance. in advance
in question, state want long uri rewritten shorter one. unfortunately, isn't clear. assuming wish remove query string using redirect, can use following:
rewritecond %{query_string} ^utm_medium=email&utm_campaign=([^&]+)&utm_source=([^&]+)&utm_term=([^&]+)$ rewriterule ^ %{request_uri}? [r=302,l] this generalised condition , rule check utm information in query string. if present, strip out query string.
if wish page/competition.html, change rule this:
rewriterule ^(page/competition\.html)$ /$1? [r=302,l] if wish remove query string forming part of request page/competition.html, can use instead of above:
rewritecond %{query_string} !^$ rewriterule ^(page/competition\.html)$ /$1? [r=302,l] this tells apache check if query string not empty and, if isn't, strip out altogether.
to make redirect permanent, change 302 301.
Comments
Post a Comment