Jump to content

Relative links don't get saved properly


WebCMS

Recommended Posts

If I enter a link to my site like "/" or "/forum" or "/clubs" or "/blogs" or "/articles", it don't resolve to the site's links but to http://<entered string>.

When clicked on:

/ should resolve to the home page (site.com).

/forum should resolve to site.com/forum

/clubs should resolve to site.com/clubs

and so on...

This is the expected behavior with any HTML editor.

Link to comment
Share on other sites

When you enter a link in the editor it automatically gets the protocol added at the start. This is how the content looks if you click the Source button in the editor to see the HTML:

<p>
	comment with a link: <a href="https://domain.com/blogs/" rel="">https://domain.com/blogs/</a>
</p>

<p>
	Relative link with a period: <a href="https://./blogs/" rel="">/blogs/</a>
</p>

<p>
	And a relative link with no period: <a href="https://blogs/" rel="">/blogs/</a>
</p>

 

If you want the relative links to work you need to manually edit the HTML by removing the protocol:

<p>
	comment with a link: <a href="https://domain.com/blogs/" rel="">https://domain.com/blogs/</a>
</p>

<p>
	Relative link with a period: <a href="./blogs/" rel="">/blogs/</a>
</p>

<p>
	And a relative link with no period: <a href="/blogs/" rel="">/blogs/</a>
</p>

 

The link with the period uses the current URL you're on as base, the one without uses only the domain.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...