Solution 1 :

Relative links on pages without trailing slash

Basically, pathname with no trailing slash implies that the loaded resource is a file in a directory delimited by prev / of the root. Checked the network tab. page was the generated filename of an html returned by the server.

Problem :

I’ve got a server that serves an html-page when /path/to/my/page endpoint is requested.

The page contains the following link:

<link href="styles/default.css" rel="stylesheet">

So when the page is loaded, I expect browser to request /path/to/my/page + styles/default.css => /path/to/my/page/styles/default.css.

But it requests /path/to/my/styles/default.css instead.

I guess that there must be some techniques to make it do what I want, but I’m not aware of them and I don’t really know what the actual question is.