chipit24
chipit24

Reputation: 6987

How to link to website base ("home page") when base tag is present?

I have the following tag inside the head of my document:

<base href="/some/folder/">.

Let's say my website is at http://example.com. A link, like this:

<a href="foo/bar/">...</a>

on the page will resolve to http://example.com/some/folder/foo/bar/.

However, a link like this:

<a href="/">...</a>

will resolve to http://example.com when I actually want it to point to http://example.com/some/folder/.

In this situation, how can I create a link to the base of my application without hardcoding http://example.com anywhere?

Upvotes: 3

Views: 126

Answers (1)

Deepanshu J bedi
Deepanshu J bedi

Reputation: 1530

Try <a href="./">...</a> instead of <a href="/">...</a>. As pointed out by cbroe

Upvotes: 4

Related Questions