benphp Posted March 28, 2013 Share Posted March 28, 2013 This is an easy one for you masters. I find it a PIA - http://myserver/calendar/events.php I want: http://myserver/calendar/ or http://myserver/calendar ? Link to comment https://forums.phpfreaks.com/topic/276273-how-to-fetch-current-url-without-page/ Share on other sites More sharing options...
PaulRyan Posted March 28, 2013 Share Posted March 28, 2013 <?PHP function getPath() { $protocol = strpos(strtolower($_SERVER['SERVER_PROTOCOL']),'https') === FALSE ? 'http' : 'https'; $host = $_SERVER['HTTP_HOST']; $path = substr($_SERVER['SCRIPT_NAME'], 0, -strlen(basename($_SERVER['SCRIPT_NAME']))); return $protocol.'://'.$host.$path; } echo getPath(); ?> Link to comment https://forums.phpfreaks.com/topic/276273-how-to-fetch-current-url-without-page/#findComment-1421646 Share on other sites More sharing options...
benphp Posted March 28, 2013 Author Share Posted March 28, 2013 Thankyou! Link to comment https://forums.phpfreaks.com/topic/276273-how-to-fetch-current-url-without-page/#findComment-1421661 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.