Vyshnavi Samudrala Vyshnavi Samudrala - 1 year ago 128
Apache Configuration Question

Redirect URLs with parameters

I have URLs like


I need to add parameters to the end of the URL like


How do I make a rewrite rule in
file to get that?

Answer Source

You can use this redirect rule:

RewriteEngine On

RewriteCond %{QUERY_STRING} !(^|&)sort_value=distance(&|$) [NC]
RewriteRule ^city/some-url-structure/?$ %{REQUEST_URI}?sort_value=distance [L,NC,QSA,NE,R=301]