.htaccess重定向到特定路由

I need to redirect a set of specific pages with particular parameters in the URL. I am a bit familiar with .htaccess redirections but this one is giving me a headache.

I want to redirect https://www.xxxxxx.com/index.php?page=shop.ask&flypage=flypage_images.tpl&product_id=182&category_id=39&option=com_virtuemart&Itemid=9

TO: https://www.xxxxxx.com/index.php?page=shop.ask

This is the rule that I have written for redirecting index and index2 but the parameters after "?" are being taken as an OR

RewriteEngine on

RewriteRule index[0-2]*.php?page=shop.(.*)$ https://www.xxxxx.com/index.php?page=shop.ask [R]

I need to escape the '?' as its taking the php as ph or php and the parameters after that are not being taken into consideration by the apache.

I have tried using the REWRITECOND as well using this rule but it doesn't work.

Please suggest the correct redirect rule.

查看全部
dougan7523
dougan7523
2017/01/13 09:02
  • redirect
  • apache
  • php
  • 点赞
  • 收藏
  • 回答
    私信
满意答案
查看全部

1个回复