php_beginner_83 Posted October 20, 2009 Share Posted October 20, 2009 Hi All I'm not sure where to ask for help on this but I hope someone can offer some. I'm at the point now where I'm trying to make my website live and the problem I've come across is updating my links, particularly the ones where I use header(). This is my first time putting a website online so this is all new to me. This is my line of code.. header('Location: http://localhost/website/places.php'); I need to change this but I'm not sure what to change it to. My home path is.. /home/vol11/5gigs.net/fiveg_4348489 Do I need to use that?? I appreciate any help. thanks Quote Link to comment https://forums.phpfreaks.com/topic/178359-solved-links-using-header/ Share on other sites More sharing options...
Dorky Posted October 20, 2009 Share Posted October 20, 2009 you cannot use header after any output to the browser. such as <html> you can make dynamic links like so <a href='http://whatever.php?page=whatever2' target='parent'>Link</a> then use conditional statements to get the desired effect. Quote Link to comment https://forums.phpfreaks.com/topic/178359-solved-links-using-header/#findComment-940534 Share on other sites More sharing options...
PFMaBiSmAd Posted October 20, 2009 Share Posted October 20, 2009 localhost in the header redirect that you posted is the domain portion of the URL. You need to use your actual domain name. You can use $_SERVER['HTTP_HOST'] to get the domain name at runtime, so you don't need to hardcode the domain into the php statement. Quote Link to comment https://forums.phpfreaks.com/topic/178359-solved-links-using-header/#findComment-940539 Share on other sites More sharing options...
php_beginner_83 Posted October 25, 2009 Author Share Posted October 25, 2009 $_SERVER['HTTP_HOST'] worked a treat! Thanks Quote Link to comment https://forums.phpfreaks.com/topic/178359-solved-links-using-header/#findComment-943889 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.