Jump to content

$_SERVER['REQUEST_URI']; help


triovia

Recommended Posts

Hello everyone.  I'm using $_SERVER['REQUEST_URI']; to read what current directory I'm in.  Everything works fine on one of my sites, however on another it's reading the current directory and file name of my include folder.

 

Example:

On the site that it works...

 

<?php

$self_url = $_SERVER['REQUEST_URI'];

echo $self_url;

?>

This script is in "/inc/nav.php" and it returns the directory that's in the address bar (which is what I want).

 

Non-working Example on another domain, but on the same server:

 

<?php

$self_url = $_SERVER['REQUEST_URI'];

echo $self_url;

?>

This script is in "/inc/nav.php" and it returns "/inc/nav.php" no the directory thats in the address bar....

 

What is causing this?

 

Link to comment
https://forums.phpfreaks.com/topic/76581-_serverrequest_uri-help/
Share on other sites

thanks... I actually looked into that and it produced the same result.  I'm on Cpanel and I never touched the php.ini file on either one of the sites... That's weird that it would act differently for each site.  You would think the php.ini file would be installed the same... hmmm. what do you think?

Sorry for the delayed response.

 

getcwd delivers this: /home/lenscape/public_html/inc

 

I want it to deliver this:  /mounting/  or /matting/  etc ... depending on what page you're on.  But it's only printing the directory on where the included file is located, which is /inc/

 

Like I said, I never really touch php.ini files and they are on the same server, just strange that they would act differently.

 

Thanks again.

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.