Okay so I've been going through my HTML lately and I discovered that I was still using the <base> element to define my website's base path. I want to get rid of that - I would like to be able to use relative URLs all the time, without having to rely on the <base> element.

Now, the problem is that using URLs like "/this/that" doesn't work the way I want it to on "localhost/project". It would lead to "localhost/this/that" instead of to "localhost/project/this/that". I don't want to prepend <?php echo $site_root_variable; ?> to all my URLs either. Does anyone know a good solution for this? Maybe adding one or two lines to my .htaccess file?

What webserver are you using on localhost?

You should look to setting up virtual hosts.

I've set up all my local development sites with their own local domain e.g. project1.dev, project2.dev

Then, drop the <base> :D and stick to absolute

First hit on google

Hope this helps.

commented: Virtual hosts are very handy when working on multiple sites +5

Well that is some useful info, thank you :)! I will look into it. If anyone has any other solutions, I'd be very happy to hear them.