qSwift Posted August 28, 2007 Share Posted August 28, 2007 I've seen scripts which get the exact url to the path where I'm using this script. It gets the full website url with sub folders, etc.: http://www.test.com/... How can I do this in php? Quote Link to comment https://forums.phpfreaks.com/topic/67148-get-website-url/ Share on other sites More sharing options...
Fadion Posted August 28, 2007 Share Posted August 28, 2007 Try this: <?php echo $_SERVER['HTTP_HOST']; //should get the domain echo $_SERVER['PHP_SELF']; //should get the script path relative to the root ?> Quote Link to comment https://forums.phpfreaks.com/topic/67148-get-website-url/#findComment-336762 Share on other sites More sharing options...
Jessica Posted August 28, 2007 Share Posted August 28, 2007 I use $url = $_SERVER['REQUEST_URI']; Quote Link to comment https://forums.phpfreaks.com/topic/67148-get-website-url/#findComment-336781 Share on other sites More sharing options...
qSwift Posted August 29, 2007 Author Share Posted August 29, 2007 yea, thanks Quote Link to comment https://forums.phpfreaks.com/topic/67148-get-website-url/#findComment-337044 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.