erme Posted July 28, 2010 Share Posted July 28, 2010 I currently have $_SERVER['REQUEST_URI'] which echos /dir/page etc How can I modify it so it only echo's /dir/ Otherwords I want to lose the page. Link to comment https://forums.phpfreaks.com/topic/209093-_serverrequest_uri/ Share on other sites More sharing options...
erme Posted July 28, 2010 Author Share Posted July 28, 2010 Should be fairly simple but I can't seem to sort it Link to comment https://forums.phpfreaks.com/topic/209093-_serverrequest_uri/#findComment-1092059 Share on other sites More sharing options...
erme Posted July 28, 2010 Author Share Posted July 28, 2010 Fixed it myself $path = $_SERVER['SCRIPT_NAME']; $basename = basename($_SERVER['SCRIPT_NAME']); $url = $path; $newurl = str_replace($basename, "", $url); echo "$newurl"; Link to comment https://forums.phpfreaks.com/topic/209093-_serverrequest_uri/#findComment-1092062 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.