Jump to content

Issue with REQUEST_URI running on WAMP


jdbnd

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?

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.