I am working on some PHP scripts which are to work on various different web servers. At the moment the scripts work with urls like the following:
I need to make it possible to switch from the above format, to the below format for servers where the above is either not possible or more complicated to configure (for end-user):
All URIs utilise a global variable which presents the start of the entire address:
But obviously the following equivalent will also be required:
The base URI is used as follows to produce the first URI, but the second scenario renders an invalid URI because it contains two ? symbols:
echo HTTP_BASE_URI . 'something/special?a=1&b=2&c=3';
This is quite a big system which contains a lot of similar (but different) scenarios. What is the best solution (one that does not rely on .htaccess) to resolve this? Ideally one which doesn't incur too many changes upon the system...