2

I am looking to redirect the URL http://www.example.com/user_pages/home_0.shtml?page=Home to http://www.example.com/. I have it redirecting to http://www.example.com/? using the following RedirectMatch:

RedirectMatch 301 ^/user_pages/home_0.shtml http://www.example.com/?

I was hoping that someone could help me figure out how to remove the trailing question mark. I understand that is the way I have it setup but that is the farthest I could get to matching what I need.

Secondary question but I think it falls in line with what I am doing here. I have the following RedirectMatch setup:

RedirectMatch 301 ^/user_pages/contactus_0.shtml http://www.example.com/help.php?section=contactus&mode=update

I am attempting to redirect http://www.example.com/user_pages/contactus_0.shtml?page=Contact%20Us to http://www.example.com/help.php?section=contactus&mode=update but I end up with http://www.example.com/help.php?section=contactus/user_pages/contactus_0.shtmlmode=update. I understand this is caused by the additional query string but I am at a lose on how to fix. Any help is appreciated.

4

1 回答 1

1

删除的一种方法的查询是这样的:

RewriteEngine On
#Test for a query with `page=`
RewriteCond %{QUERY_STRING} ^page=.*$   
RewriteRule .* http://www.example.com? [L,R=301]

最后一个将删除查询,包括

至于问题的最后一部分,请查看我的评论。

于 2012-12-05T05:27:08.667 回答