0

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?

2
Contributors
4
Replies
36
Views
4 Years
Discussion Span
Last Post by minitauros
5

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.

Votes + Comments
Virtual hosts are very handy when working on multiple sites
0

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.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.