I currently have the following in a config file in my application:
define('DOCROOT', dirname(__FILE__).DIRECTORY_SEPARATOR);
define('WEBROOT', 'http://localhost/samples/');
The first line works perfectly. I can include the config file anywhere and then use the DOCROOT
constant as expected.
The second line works as well, but it's hardcoded, which means that when I upload this file to my webserver, it will be wrong. There it should be http://samples.example.com
. Is there a good way to somehow prevent this hard coding? I kind of think that I have to hard code something somewhere, and in that case, what and how little can I get away with?