Monday 16 July 2018

Removing the Query String from a .htaccess Redirect

Removing the Query String from a .htaccess Redirect

Are you doing a URL rewrite using a .htaccess file but the query string is being carried through also to the new URL, even though you haven’t specified it using QSA (Query String Append)?
To prevent this additional query string being appended to the destination address simply add a question mark to to the new address. A quick example might be:
RewriteRule ^pages/.*$ http://www.my-dest-domain.com? [R=301,L]
Voila, no more query string :) Now wasn’t that simple!

0 comments:

Post a Comment