简单的301重定向在.htaccess与查询字符串不以重定向指令工作 [英] Simple 301 redirect in .htaccess with query string does not work with Redirect directive

查看:224
本文介绍了简单的301重定向在.htaccess与查询字符串不以重定向指令工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想重定向在.htaccess文件的单个URL以重定向

I am trying to redirect a single URL in a .htaccess file with Redirect:

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

我有一帮其工作中使用的目录结构的网址其它类似的规则,但是这一次拒绝得到处理。

I have a bunch of other similar rules which work using directory structure URLs, but this one refuses to get processed.

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

我必须做什么特别的?

Do I have to do anything special?

谢谢!

推荐答案

通过 重定向 你可以为网址只考路径的,或者更具体地说,URL路径prefixes但不为URL查询。但你可以做到这一点 mod_rewrite的

With Redirect you can only test for URL paths, or more specifically, URL path prefixes but not for the URL query. But you can do so with mod_rewrite:

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

这篇关于简单的301重定向在.htaccess与查询字符串不以重定向指令工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆