Search code examples
htmlhyperlinkhref

Hyperlink base link


I have a link that I want to go to something.com/one/two
I try to do the following

<a href = "one/two">Link</a>

When clicked from something.com then it does go to something.com/one/two when clicked from something.com/one then it goes to something.com/one/one/two.
Is there any way to specify one a href so that it can go to something.com/one/two? I do not want href to be something.com/one/two.


Solution

  • Add a forward slash to beginning so that it starts from the root:

    <a href="/one/two">Link</a>