So this is the thing, Im building dispatcher class that needs to dispatch http requesd based on Request URI, so Im interesed only in part of URI that comes behind domain.
Now when im working on live server on URI like this:
www.domain.com/controller/method/params/
REQUEST_URI would return:
/controller/method/params/
But when im working on local machine i have URI like this:
localhost/project/controller/method/params/
and REQUEST_URI would return:
/project/controller/method/params/
So is there an elegant and neat way to tell php to get me only the params I need fromu URI?
It dosent have to be $_SERVER[‘REQUEST_URI’], but I need that string the same on both live and local server?
Thanks!
Dispatcher compares current request URI with URI defined in config file. And on live server it matches, but on local machine there is one segment more then on live server.
How could I deal with this?
Usually I configure my local webserver to respond on “test.mysite.com” and in hosts file i set test.mysite.com to 127.0.0.1, in that way i better simulate production environments, and i’m not forced to use subpaths in urls
If you use apache webserver, you can simply setup N virtual hosts.