开发者

RewriteCond and Full QUERY_STRING

开发者 https://www.devze.com 2022-12-31 02:31 出处:网络
I\'m having hard time getting my head wrapped around this one - and it should be trivial. I would like to redirect one URL with a specific query string to another URL.

I'm having hard time getting my head wrapped around this one - and it should be trivial.

I would like to redirect one URL with a specific query string to another URL.

I want to send any requests that contain the query string in the URL

http://example.com/index.php?option=com_user&view=register

To:

http://example.com/index.php?option=com_regme&view=form&regme=4&random=0&Itemid=6

If they add anything to the end of the first URL, it should still go to the second URL so that they cannot bypass the redirection. Nothing in the first query string needs to be preserved and passed to the second - all I want to do is change the URL completely.

I'm tearing my hair out trying to get this to work 开发者_Python百科yet it should be trivial.

Suggestions?

Thanks,

-Tim


Since the parameters may appear in any order, try this rule:

RewriteCond %{QUERY_STRING} (^|&)option=com_user(&|$)
RewriteCond %{QUERY_STRING} (^|&)view=register(&|$)
RewriteRule ^ /index.php?option=com_regme&view=form&regme=4&random=0&Itemid=6 [L,R=301]
0

精彩评论

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