Jump to content

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/126100-issue-with-request_uri-running-on-wamp/
Share on other sites

$_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?

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.