I need 2 different paths, one for include and one for js / css, etc. I use mod_rewrite. The following works great ....
Currently, all my files contain this at the top
define('SERVER_ROOT', 'C:/wamp/www/site_folder/');
define('SITE_ROOT', 'http://localhost/site_folder/');
and then the files are called like this:
require_once SERVER_ROOT . 'st_wd_assets/inc/func_st_wd.php';
<link rel="stylesheet" type="text/css" href="<?php echo SITE_ROOT;?>st_pages/user_area/css/user_area.css" media="screen"/>
as you are likely to see, it will be a huge task to update the top of each file every time I move versions between the local host and my server.
What is the best / standard way to determine these ROOT values?
I do not see a solution in a super-global $_SERVER? Do people usually use VirtualHosts? But then you still would not have to define the ROOT constants?
source
share