Forum Moderators: coopster

Message Too Old, No Replies

$ SERVER["REQUEST URI"] includes domain unexpectedly

         

stidj

4:56 pm on Sep 14, 2007 (gmt 0)

10+ Year Member



Hey guys

In my old server running Apache 1.3 and PHP 4 this code will return just the URI as expected:

$_SERVER["REQUEST_URI"] = "/some-html-file.html"

In my new server with Apache 2 & PHP 4 this code returns the domain:
$_SERVER["REQUEST_URI"] = "/full-domain-name.com/some-html-file.html"

Does anyone know a way to change things so the code will not return the domain name and whether this is because of PHP or Apache that I'm suddenly getting the full domain name?

Thanks guys

phparion

5:35 am on Sep 15, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I guess REQUEST_URI returns full path including domain name.

anyway you can print_r($_SERVER); to see all the variables and then choose whichever provides you the exact value you want also you can read the parse_url() manual [php.net]

vincevincevince

7:02 am on Sep 15, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Very strange. I wonder if you can't use PHP_SELF?

coopster

10:50 pm on Sep 16, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Strange indeed. Are you certain there isn't some type of redirection in place? Check your headers during a request to see ...