Reputation: 336
I migrated servers and now this variable $_SERVER['DOCUMENT_URI']
stopped working, what can I do?
I'm temporarily using this solution: $uri_parts = explode('?', $_SERVER['REQUEST_URI'], 2)[0];
but there's a lot of code that uses $_SERVER['DOCUMENT_URI']
and I don't want to be changing all of that.
Upvotes: 0
Views: 980
Reputation: 146450
DOCUMENT_URI
is not a standard variable as far as I can tell. Whatever, there're two things to note about the $_SERVER
superglobal:
You can just set an environment variable by whatever mean you prefer (for instance, the SetEnv
directive if you happen to use Apache) or simply put your own value right into the PHP variable.
Upvotes: 1