MrSean Posted May 14, 2011 Share Posted May 14, 2011 Sample URL: http://localhost/cms/page/home/ The script is in: /www/cms/ ROOT should be where the script is installed. URL should be the rest of the url (ignoring query string) This is what I have: define('ROOT', (dirname(__FILE__))); $URL = str_replace(realpath($_SERVER['DOCUMENT_ROOT']).'/', '', realpath(dirname(__FILE__))).'/'; define('URL', str_replace('/'.$URL, '', $_SERVER['REQUEST_URI'])); echo "ROOT:".ROOT . "<br />"; echo "URL:".URL . "<br />"; So, is there a cleaner way f doing this? Link to comment https://forums.phpfreaks.com/topic/236427-a-better-way-of-getting-various-data-from-url/ Share on other sites More sharing options...
MrSean Posted May 15, 2011 Author Share Posted May 15, 2011 Hello? Is there no better way? Link to comment https://forums.phpfreaks.com/topic/236427-a-better-way-of-getting-various-data-from-url/#findComment-1215673 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.