我需要一些帮助
我的方案是我想重定向用户(使用示例网址)
FORM www.example.com/affiliate.php?_m=12&fl=345
要 www.example.com/affiliate.php
我使用下面的规则,但它不起作用
RewriteCond %{HTTP_HOST} ^example.com$ [NC]
RewriteCond %{QUERY_STRING} ^_m=([0-9]*)&fl=([0-9]*)$
RewriteRule ^affiliate.php$ http://www.example.com/affiliate.php [R=301,L,QSD]
注意:我也在使用
Redirect 301 /affiliate/ http://example.com/affiliate.php
将www.example.com/affiliate重定向到http://example.com/affiliate.php 哪个工作正常
任何帮助都将受到高度赞赏
答案 0 :(得分:0)
Note: I am also using
Redirect 301 /affiliate/ http://example.com/affiliate.php
这是错误的。您无法将Redirect
与RewriteRule
一起使用。这是两个不同的apache模块。 Redirect
指令是alias
模块的一部分,而RewriteRule
是mod-rewrite
的一部分。由于两个指令具有不同的运行时行为,因此不能将它们一起用于处理类似的请求。 / p>
尝试:
RewriteEngine on
RewriteCond %{QUERY_STRING} ^_m=([0-9]*)&fl=([0-9]*)$
RewriteRule ^affiliate.php$ http://www.example.com/affiliate.php? [R=301,L,QSD]
#redirect /affiliate to /affiliate.php
RewriteRule ^affiliate/?$ /affiliate.php [L]