【问题标题】:Remove parameter from URL viac .htaccess从 URL viac .htaccess 中删除参数
【发布时间】:2012-02-15 20:48:42
【问题描述】:

我需要建议如何使用从 url 中删除参数。 htcaccess

条件如下:

重定向网址来自:

http://example.com/?movie=2&ref=nf

到:

http://example.com/?movie=2

我尝试了几个选项,但我没有一无所获

感谢您的想法/建议。

谢谢。

【问题讨论】:

    标签: .htaccess url-rewriting


    【解决方案1】:

    尝试将以下内容添加到站点根目录中的.htaccess 文件中。

    RewriteEngine on
    RewriteBase / 
    
    #If request contains ref param
    RewriteCond %{THE_REQUEST} \?([^&\ ]+)&ref=  [NC]  
    #redirect to URL without the ref param
    RewriteRule ^  %{REQUEST_URI}?%1 [L,R=301] 
    

    【讨论】:

    • 我收到了一个答复表单服务器内部服务器错误 500。
    • @JozífekChramršt 抱歉 - 我有错字,现在试试上面
    猜你喜欢
    • 2016-10-09
    • 2021-02-05
    • 2016-03-05
    • 2013-01-01
    • 2017-11-22
    • 1970-01-01
    • 1970-01-01
    • 2015-07-21
    • 2018-05-12
    相关资源
    最近更新 更多