Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1
  1. #1
    Regular Coder student101's Avatar
    Join Date
    Nov 2007
    Posts
    634
    Thanks
    80
    Thanked 15 Times in 15 Posts

    Question redirect specific incoming links using PHP?

    How would I be able to redirect all these incoming links to root?
    this is exists for every incoming link home.php?pg=(number)

    Do I need to check that the incoming link has the rule above then redirect to http://www.example.com/

    Any ideas welcome.

    Edit: I was thinking of a function that checks if the pg var is a num then redirect?
    PHP Code:
    if (is_numeric($_GET['pg'])){
    $redirectnum is_numeric($_GET['pg'])
    $redirect = array(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18);
    if(
    in_array($redirectnum$redirect)){
    header ("Location: http://www.example.com/");
    }



    Edit: This seems to work:
    PHP Code:
    <?php
    $redirect 
    = array(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,"anytextvartoo");
    if( 
    in_array($_GET['pg'], $redirect ) || in_array($_GET['blg'], $redirect ) ) {
    header("Location: http://www.example.com"true301);
    exit();
    }
    ?>
    Last edited by student101; 03-04-2012 at 11:31 AM.
    Thanks for your support!
    Update MySQL with checkboxes | Tell A Friend | Delete MySQL with checkboxes

    Give thanks & resolve when done :thumbsup:


 

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •