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? Quote Link to comment Share on other sites More sharing options...
trq Posted October 26, 2009 Share Posted October 26, 2009 $_SERVER['PHP_SELF']. Quote Link to comment 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; } Quote Link to comment 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.