Search code examples
htmlurlhyperlinkhref

Resolving paths in href


I have my href attribute set as:

<a href="/somePage"></a>

But I migrated my page from localhost to www.example.com, and now path to /somePage looks like www.example.com/myApp/somePage instead of localhost/somePage.

How can I make my href attribute correctly redirect to /somePage, no matter which prefixes I would add?


Solution

  • You should use use a . (dot) for assign the relative path

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