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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.