jdbnd Posted September 27, 2008 Share Posted September 27, 2008 Folks, I've got an issue with some website code (PHP inside one of my webpages) and was hoping somebody here might have an idea. Here's the offending code: <div id="rate-site"<?php if ( $_SERVER['REQUEST_URI']=='/' ) echo ' class="invisible"'; ?>> This is used to make the "rate-site" page element invisible on the home page, e.g. when the browser requests "http://localhost/wheremysiteis/" The only problem is that it doesn't work. When I go to that URL, that's exactly what shows in the URL bar (it doesn't resolve to /index.php or anything) and I also tried replacing '/' with '/index.php' or '/index.php/' - makes no difference. The code was originally written for PHP4, so maybe this function behaves differently in PHP5? Help... please.... hopefully it's something simple and dumb. Thanks, Joe Quote Link to comment https://forums.phpfreaks.com/topic/126100-issue-with-request_uri-running-on-wamp/ Share on other sites More sharing options...
corbin Posted September 28, 2008 Share Posted September 28, 2008 Have you considered echoing out the variable to see what it's actually set to and then working with it from there? Quote Link to comment https://forums.phpfreaks.com/topic/126100-issue-with-request_uri-running-on-wamp/#findComment-652211 Share on other sites More sharing options...
wildteen88 Posted September 28, 2008 Share Posted September 28, 2008 $_SERVER['REQUEST_URI'] returns everything after your domain, so if your url is http://localhost/wheremysiteis/ then $_SERVER['REQUEST_URI'] will return "/wheremysiteis/" What are you trying to do with $_SERVER['REQUEST_URI'] variable? See if it ends in a forward slash? Quote Link to comment https://forums.phpfreaks.com/topic/126100-issue-with-request_uri-running-on-wamp/#findComment-652400 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.