简体   繁体   中英

How to redirect a php page with different

I don't have so much knowledge of programming, so I want some help. I want to redirect 301 a url /viewforum.php?f=19 to another page. So want to put in viewform.php to do so. I using the following code

<?php
header("HTTP/1.1 301 Moved Permanently");
header("Location: http://www.example.com/");
exit();
?>

But it redirecting everything within /viewform.php but I only want to redirect /viewform.php?f=19

<?php
        if($_GET['f']==19)
        {    
            //header("HTTP/1.1 301 Moved Permanently"); no need
            header("Location: http://www.example.com/");
            exit();
        }
?>

Hope it will help

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM