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? 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 ?> 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']; 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 Link to comment https://forums.phpfreaks.com/topic/67148-get-website-url/#findComment-337044 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.