htaccess 301 redirect - Remove query string (QSA) htaccess 301 redirect - Remove query string (QSA) apache apache

htaccess 301 redirect - Remove query string (QSA)


You can use this rule:

RewriteRule ^menu\.php$ /new-page-name? [L,R=301]

Take note of trailing ? in the end which is used for stripping off any existing query string in the original URI.


In addition to anubhava's answer you can alternatively use the QSD flag from Apache 2.4.0

RewriteRule ^menu\.php$ /new-page-name [L,R=301,QSD]

http://httpd.apache.org/docs/current/en/rewrite/flags.html#flag_qsd