How to link to a page in the current domain without writing a full URL

Say the current URL example.com/test/example

and let's say I want to set a link to example.com/test/example/another

<a href="/another"> connects me with example.com/another

How can I link to example.com/test/example/anotherwithout putting the full url in the tag a?

+5
source share
3 answers

<a href="another">

must do it. Strike>

EDIT: My bad, this is actually:

<a href="./another">
+3
source

I would suggest using root paths if you don't want to use absolute paths:

<a href="/test/example/another">Link text</a>

Otherwise, for relative paths, the itdoesntwork answer covers a use case.

+3
source

You can try the following: href="another"

-2
source

All Articles