You can use constants in the settings file or in index.php:
define('LOCAL_URL', 'http://localhost/test-site/'); define('DISTANT_URL', 'http://domain.tld/'); define('DEV_VERSION', true);
And then:
if(DEV_VERSION) define('URL', LOCAL_URL); else define('URL', DISTANT_URL);
This way you can just use the URL constant in your code, for example:
<link rel="stylesheet" type="text/css" href="<?php echo URL; ?>style/site.css" />
The advantage is that it works in all cases.
And just add debug controls:
if(DEV_VERSION) error_reporting(E_ALL ^ E_DEPRECATED ^ E_USER_DEPRECATED); else error_reporting(0);
source share