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 3 of 3
  1. #1
    New Coder
    Join Date
    Sep 2012
    Posts
    21
    Thanks
    3
    Thanked 0 Times in 0 Posts

    header('Location: ') question

    So I have a header('Location: ') in my script and it works fine if I enter something like

    PHP Code:
    header('Location: profile.php '
    It will go to www.example.com/profile.php

    But I am trying to make it go to the homepage of the site which is just www.example.com. I don't want it to show index.php or default.php.

    So my question is what do I need to put in header('Location: ') for it to direct back to the homepage www.example.com

    Thanks
    Last edited by penny94; 11-05-2012 at 12:04 AM.

  • #2
    Senior Coder
    Join Date
    Feb 2011
    Location
    Your Monitor
    Posts
    4,476
    Thanks
    63
    Thanked 538 Times in 525 Posts
    http://www.example.com would do the trick nicely.
    I can't really think of anything to write here now...

  • #3
    Super Moderator Inigoesdr's Avatar
    Join Date
    Mar 2007
    Location
    Florida, USA
    Posts
    3,647
    Thanks
    2
    Thanked 406 Times in 398 Posts
    You can either use the full domain, or "/":
    PHP Code:
    header('Location: http://www.example.com/');
    // or
    header('Location: /'); 


  •  

    Posting Permissions

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