Reputation: 1642
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?
Upvotes: 2
Views: 8414
Reputation: 41
You have to use the full path.
Example:
<base href="<?="http://".$_SERVER['HTTP_HOST']."/"?>My_Site/" />
Upvotes: 4
Reputation: 1333
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)
Upvotes: 4
Reputation: 13785
In this case, my guess is that there is some character, outside any tags, before the tag. Consider this:
<base href="http://domain.net/qu/en/" />
<a href="sample">Sample Link</a>
Upvotes: 1