301 .htaccess 重定向问题
301 .htacess redirect issue
我正在制作一个网站,(为了举例,它将 http://www.example.com).
I am trying to make it redirect http://example.com/jquery/releasenotes to http://blog.jquery.com/?s=release+notes
By using this it put a /
on the end, this stops it from working, since it searches for the /
aswell. I tried using http://goo.gl and converted it to http://goo.gl/WdiItL Somehow this also fails to remove the /
when in redirect. However if you simply go to http://goo.gl/WdiItL 正常运行。我的 .htaccess 文件如下所示:
Redirect 301 /jquery/releasenotes http://goo.gl/WdiItL
我不知道如何让它的末尾没有 /
。
任何帮助将不胜感激!
我认为你必须使用 mod_rewrite 的 %{QUERY_STRING}
例如:
RewriteCond %{HTTP_HOST} =example.com [NC]
RewriteCond %{QUERY_STRING} ^(par1=1&par2=2)
RewriteRule ^$ http://alt.example.com/?%1 [R=301,L]
使用此 RedirectMatch
规则:
RedirectMatch 301 ^/jquery/releasenotes/?$ http://goo.gl/WdiItL
确保在测试之前清除浏览器缓存
我正在制作一个网站,(为了举例,它将 http://www.example.com).
I am trying to make it redirect http://example.com/jquery/releasenotes to http://blog.jquery.com/?s=release+notes
By using this it put a /
on the end, this stops it from working, since it searches for the /
aswell. I tried using http://goo.gl and converted it to http://goo.gl/WdiItL Somehow this also fails to remove the /
when in redirect. However if you simply go to http://goo.gl/WdiItL 正常运行。我的 .htaccess 文件如下所示:
Redirect 301 /jquery/releasenotes http://goo.gl/WdiItL
我不知道如何让它的末尾没有 /
。
任何帮助将不胜感激!
我认为你必须使用 mod_rewrite 的 %{QUERY_STRING}
例如:
RewriteCond %{HTTP_HOST} =example.com [NC]
RewriteCond %{QUERY_STRING} ^(par1=1&par2=2)
RewriteRule ^$ http://alt.example.com/?%1 [R=301,L]
使用此 RedirectMatch
规则:
RedirectMatch 301 ^/jquery/releasenotes/?$ http://goo.gl/WdiItL
确保在测试之前清除浏览器缓存