Forum Moderators: phranque

Message Too Old, No Replies

REQUEST_URI is everything after the domain name

but how do you call what's between the domain name and the QUERY_STRING?

         

alexis

5:08 pm on Feb 25, 2005 (gmt 0)

10+ Year Member



in PHP I made myself a variable called uriNoQS that stands for 'REQUEST_URI' with no 'QUERY_STRING'.

$uriNoQS=substr($_SERVER['REQUEST_URI'],0,strlen($_SERVER['REQUEST_URI'])-strlen($_SERVER['QUERY_STRING'])-1);

It works fine but it looks like a script that could be replaced by something simpler...

I played with 'SCRIPT_NAME' but it doesn't work because none of the urls of the site I'm developing actually exist (it's all fake URLS redirecting to index.php with a .htaccess). So "/jazz/moo/" script_name is "/index.php" but that's not what I want.

Is there a more direct way then the $uriNoQS php twist?

ogletree

5:22 pm on Feb 25, 2005 (gmt 0)

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



Try parse_url

usage:

array parse_url ( string url )

[us4.php.net...]