0

I'm starting to create websites with admin areas in different directories. So I'm starting to use the HTML base tag to tell the browser the base location for relative paths to start at. It seems to work great for everything except one thing.

My problem is that when I do this:

<base href="http://localhost/testsite/"> ... <a href="/">Link to home</a> 

That link doesn't take me to my testsite index.html page, it takes me to the localhost directory tree. Am I doing something wrong here?

1 Answer 1

1

You are not using a relative path there, it's an absolute path. The relative path to the current folder would be a single period:

<a href=".">Link to home</a> 
Sign up to request clarification or add additional context in comments.

2 Comments

Ah I knew it would be something simple. Thanks for the help, green tick coming your way.
The URL / is relative, not absolute. The problem is that it is relative to the server root, not to the current base URL (as . is).

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.