htaccess 301 redirect - Remove query string (QSA)

前端 未结 2 1128
清歌不尽
清歌不尽 2020-11-29 08:13

I\'ve been struggling with some htaccess redirects. I just spent some time reading and searching on stack and couldn\'t get an anwser that works with my scenario.

I\

相关标签:
2条回答
  • 2020-11-29 08:44

    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

    0 讨论(0)
  • 2020-11-29 08:47

    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.

    0 讨论(0)
提交回复
热议问题