Php – Base href not working on IE – alternative

basehrefincludeinternet explorerPHP

So after doing a lot of research I found base href, and I decided I should use it to build my website. After finishing I noticed that it was working on every browser(latest version): Chrome/Firefox/Opera except IE 9.

My site is built like that, on localhost:

<base href="/My_Site/" />

Then I use php include to add elements found on root directory and not in the same folder with current page:

<?php include "../header.php"?>

Now since I will be uploading this to the web, I suppose base href will be changed from My_Site to http://mysite.com/ and I wanted to know if everything will be working after doing so? What do I have to do to make it work on IE too?

Best Answer

You have to use closer tag for base in IE, other browsers require only self-close. So it should be:

<base href="/My_Site/" /><!--[if IE]></base><![endif]-->

(Assuming that href value is correct)