Add trailing slash to taxonomy term. Issue with relative URL We were trying to create relative links by using href="Link" or href="./Link" 

This works on all browsers, but in Drupal we are running into a problem becasue Drupal removes trailing slash from existing URL. 

For example if we are at page or taxonomy term page

domain.com/term1/child1A

and in there have a link such as a href="Link" it will point to domain.com/term1/Link

becasue child1A does not have a trailing slash. 

Is there any way to fix this issue. Technically we are not trying to add trailing slashes to all url. Tried setting base URL but that didn't work either. Or maybe I did something wrong. 

Any suggestions on a workaround? 

Drupal 8.4
The key to this answere is that the URL needs to end with a slash. 

I turns out Redirect modules will remove trailing slashes. 

You can disable clean URLs if you want trailing slash. Which is not ideal. 

A workaround would be to use this code for particular links: 

&lt;p&gt;&lt;a href="home" id="relurl" target="_blank" title="This is a relative link!"&gt;link&lt;/a&gt;


var x = window.location.href; // Current page URL
var link = document.getElementById("relurl"); // store the element
var curHref = link.getAttribute('href'); // Get HREF paramter
link.setAttribute('href', x + "/"+ curHref);