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'; } Quote 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'; Quote 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 Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.