I have a local site: http://domain.loc/
and that site have subdomain: http://sub.domain.loc/
.
How can I configure my Apache
server || PHP
to make him return global variable: $_SERVER['REQUEST_URI'
] with my subdomain name ("sub" in this case)?
Examples:
If I'll open the page http://domain.loc/
then $_SERVER['REQUEST_URI']
will be equal to /
If I'll open the page http://sub.domain.loc/
then $_SERVER['REQUEST_URI']
will be equal to /sub/
Not possible. REQUEST_URI
is what comes AFTER the hostname component of a url:
http://example.com/foo/bar/baz
^--- HTTP_HOST
^---- REQUEST_URI
You can certainly have your subdomain name in the URI component, but that's something YOU have to do, and something Apache+PHP won't. They're not going to rewrite fundamental definitions of URLs just to suit you.