Remove query string from redirected URL with htaccess

前端 未结 1 1975
迷失自我
迷失自我 2020-12-18 01:51

I\'m using the following code to redirect traffic to a spesific page (this traffic is coming via google from an old site which used to use my servers ip)

Re         


        
相关标签:
1条回答
  • 2020-12-18 02:23

    You were close to the answer... You have the ? on the wrong side. Put it on the redirect side to strip off the query string:

    RewriteRule ^viewtopic.php http://www.myurl.org.uk/? [L,R=301]
    

    In a 301 redirect, mod_rewrite will normally append the full query string. But placing a ? at the end of your rewritten URL without a corresponding [QSA] ("querystring append") flag will instruct it instead to use the blank query string you supplied.

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