View Full Version : header('Location: ') question

11-04-2012, 11:58 PM
So I have a header('Location: ') in my script and it works fine if I enter something like

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


11-05-2012, 12:34 AM
http://www.example.com would do the trick nicely.

11-05-2012, 12:34 AM
You can either use the full domain, or "/":

header('Location: http://www.example.com/');
// or
header('Location: /');