繁体   English   中英

.htaccess中带有查询字符串的简单301重定向不适用于Redirect指令

[英]Simple 301 redirect in .htaccess with query string does not work with Redirect directive

我正在尝试使用Redirect .htaccess文件中的单个URL:

Redirect 301 /index2.php?option=com_rss&feed=RSS2.0&no_html=1 /something/somethingelse/

我还有很多其他类似的规则,它们使用目录结构URL起作用,但是该规则拒绝得到处理。

Redirect 301 /old/url/ /new/url/

我需要做些特别的事情吗?

谢谢!

使用Redirect您只能测试URL路径 ,或更具体地说,是URL路径前缀,而不能测试URL查询。 但是您可以使用mod_rewrite来做到这一点:

RewriteEngine on
RewriteCond %{QUERY_STRING} =option=com_rss&feed=RSS2.0&no_html=1
RewriteRule ^index2\.php$ /something/somethingelse/? [L,R=301]

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM