I need 2 different paths, one for includes and one for js/css etc. I’m using mod_rewrite. The below works fine….
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 files are called like so:
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 can probably see, it’s going to be a massive chore to update the top of every file everytime i move versions between the localhost and my live server.
What’s the best/standard way of defining these ROOT values?
I can’t see a solution in the $_SERVER super global? Do people normally just use VirtualHosts? But then wouldn’t it still be necessary to define ROOT constants?
Yes.
People normally just use VirtualHosts.
There are several ways.
php_value auto_prepend_filein .htaccess