开发者

How to redirect dynamic pages with htaccess

开发者 https://www.devze.com 2023-01-02 23:11 出处:网络
I have some old indexed pages like: index.php?action=addon_googlemap_showmap&listingID=XXXXX&popup=1

I have some old indexed pages like:

index.php?action=addon_googlemap_showmap&listingID=XXXXX&popup=1

index.php?action=addon_googlemap_showmap&listingID=XXXXX&popup=yes

and I want to redirect them to new urls:

index.php?action=listingview&listingID=XXXXX

XXXXX开发者_运维问答 is a number.

What should I put in my htaccess file?

Thank you in advance.


mod_rewrite is not worth the headaches (especially in .htaccess).

I would strongly recommend you put a redirect in your index.php instead. Something like

<?php
if ($_GET['action'] == 'addon_googlemap_showmap') {
    header("HTTP/1.1 301 Moved Permanently"); 
    header("Location: http://...../index.php?action=listingview&listingID=" . $_GET['listingID']);
    exit();
}
0

精彩评论

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

关注公众号