2012-02-15 96 views
1

我需要建议如何使用从URL中删除参数。 Htcaccess从URL中删除参数viac .htaccess

条件如下:

重定向URL来源:

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

到:

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

我尝试了几种选择,但我还没有落空

感谢您的意见/建议。

THX。

回答

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] 
+0

我得到的回答表格服务器内部服务器错误500 – 2012-02-15 23:31:29

+0

@JozífekChramršt对不起 - 我有一个错字,试上方现在 – 2012-02-16 00:10:05

+0

感谢了很多:) – 2012-02-20 11:53:05