开发者

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

开发者 https://www.devze.com 2023-01-11 08:24 出处:网络
I am trying to redirect a single URL in a .htaccess file with Redirect: Redirect 301 /index2.php开发者_如何学C?option=com_rss&feed=RSS2.0&no_html=1 /something/somethingelse/

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

Redirect 301 /index2.php开发者_如何学C?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?

Thanks!


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

精彩评论

暂无评论...
验证码 换一张
取 消