Ideal development scenario using localhost and subdomains?

For a while, I have been developing locally like so:


I use a defined constant in PHP for the root directory ‘/’

Instead of : <img src=“/images/some_image.jpg” />

define(‘ROOT’, ‘/Acme/’);

<img srce=“<?php echo ROOT;?>images/some_image.jpg” />

Now, I have switched from putting client sites as a sub-directory to a sub-domain.


To: http://acme/

This allows using ‘/’ for absolute URLs on the remote development server but still not on my local machine.

Is there a way to avoid using the defined constant approach on my local machine?

Thanks in advance!

I used to do some voodo with PHP server variables to work this math out, but its been a while since I did any significant PHP so I can’t recall.

I’d bet most of the major PHP packages have something worked out for this now . . .