erme Posted July 26, 2012 Share Posted July 26, 2012 Hi Have this code which works great is the url is actually /welcome.html, but how can I adapt it so it works if the url contains /welcome.html ( eg /welcome.html?action=blah ) $uri = $_SERVER['REQUEST_URI']; $root = $_SERVER['DOCUMENT_ROOT']; if ($uri != '/welcome.html') { include ''.$root.'/inc/aside.php'; } Link to comment https://forums.phpfreaks.com/topic/266272-if-url-contains-something-do-this/ Share on other sites More sharing options...
silkfire Posted July 26, 2012 Share Posted July 26, 2012 Use SCRIPT_NAME to get the path to the file without the query strings. if ($_SERVER['SCRIPT_NAME'] != '/welcome.html') include $_SERVER['DOCUMENT_ROOT'] . '/inc/aside.php'; Link to comment https://forums.phpfreaks.com/topic/266272-if-url-contains-something-do-this/#findComment-1364521 Share on other sites More sharing options...
erme Posted July 26, 2012 Author Share Posted July 26, 2012 perfect! thanks very much Link to comment https://forums.phpfreaks.com/topic/266272-if-url-contains-something-do-this/#findComment-1364524 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.