MDanz Posted October 26, 2009 Share Posted October 26, 2009 how do i get the url of the page i'm currently on, on my website.. i think its get header.. how do i do that? Link to comment https://forums.phpfreaks.com/topic/178999-get-url/ Share on other sites More sharing options...
trq Posted October 26, 2009 Share Posted October 26, 2009 $_SERVER['PHP_SELF']. Link to comment https://forums.phpfreaks.com/topic/178999-get-url/#findComment-944378 Share on other sites More sharing options...
Alex Posted October 26, 2009 Share Posted October 26, 2009 It's always a good idea to Google (or whatever search engine you prefer) what you're looking for before you post a topic. A simple search returns this page: http://www.webcheatsheet.com/PHP/get_current_page_url.php. function curPageURL() { $pageURL = 'http'; if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";} $pageURL .= "://"; if ($_SERVER["SERVER_PORT"] != "80") { $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"]; } else { $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]; } return $pageURL; } Link to comment https://forums.phpfreaks.com/topic/178999-get-url/#findComment-944380 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.