Results 1 to 6 of 6

Thread: How to redirect user browser to a specific page using php?

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Apr 2005
    Posts
    1,907

    Talking How to redirect user browser to a specific page using php?

    Hi all . i wonder how i can redirect a visitor of my webpage to specified page ? What i mean suppose some one visits a page in my webiste and i am admin want to direct his webbrowser to a page like www.cnn.com . i be happy if an expet show me how that can be done.Thanks
    Last edited by tony007; Apr 22nd, 2006 at 05:13 AM.

  2. #2
    <?="Moderator"?> john tindell's Avatar
    Join Date
    Jan 2002
    Location
    Brighton, UK
    Posts
    1,099

    Re: How to redirect user browser to a specific page using php?

    use the header() function to do this.
    PHP Code:
    header('location: http://www.vbforums.com/'); 

  3. #3

    Thread Starter
    Frenzied Member
    Join Date
    Apr 2005
    Posts
    1,907

    Re: How to redirect user browser to a specific page using php?

    Quote Originally Posted by john tindell
    use the header() function to do this.
    PHP Code:
    header('location: http://www.vbforums.com/'); 
    how to do this dynamically and diffrent for each user currently visting my page ? what i mean push page .That is what i was looking :-(

  4. #4
    PowerPoster lintz's Avatar
    Join Date
    Mar 2003
    Location
    The 19th Hole
    Posts
    2,697

    Re: How to redirect user browser to a specific page using php?

    You would have to have a pre-defined list of sites that each user would be re-directed to so when you check which user is accessing your page they automatically get re-directed to the correct page.....HTH

  5. #5

    Thread Starter
    Frenzied Member
    Join Date
    Apr 2005
    Posts
    1,907

    Unhappy Re: How to redirect user browser to a specific page using php?

    Quote Originally Posted by lintz
    You would have to have a pre-defined list of sites that each user would be re-directed to so when you check which user is accessing your page they automatically get re-directed to the correct page.....HTH
    lol. Thans for u reply. Storing the url list is not problem i can do that in db but the issue is how to send the url for perticuler visitor and it pops up in his browser!! That is the trick . It is very nice thing but i did not figure it out yet. I hope some one show me a good reliable solution for it.

  6. #6
    PowerPoster lintz's Avatar
    Join Date
    Mar 2003
    Location
    The 19th Hole
    Posts
    2,697

    Re: How to redirect user browser to a specific page using php?

    Do what John posted.

    PHP Code:
    //User accesses your page
    //Get user details from db including URL that user should be redirected to

    //Redirect user
    header('location: $UserURL'); 

Posting Permissions

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



Click Here to Expand Forum to Full Width