Hosting setups that add a trailing back slash to urls break all inter-site links on the page.
Yes
npx @docusaurus/init@next init test-site classica and ba.md to a folder, and b.md to b folder.sidebar.js with attached version.npm run build to generate the flat site.a: http://127.0.0.1:8080/docs/a/aLink to page "b"Page b should load.
Page Not Found page.
(Paste the link to an example repo, including a siteConfig.js, and exact instructions to reproduce the issue.)
@littlespex are you sure the browser is adding that slash? Try running your site locally and see if the slash gets added. If not, it most likely is your hosting server.
FYI I am seeing the same behavior on Netlify (adding the slash, breaking the links)
馃挕 If you are using Netlify, disabling Pretty URLs should solve the problem. I unchecked the first two boxes to prevent Netlify from both lowercasing the urls and.. adding the trailing slash.

I had updated the ticket description earlier to mention the hosting environment instead of the browser. Unfortunately we don鈥檛 have admin control over our docs environment and the team that runs it has enabled these url rewrite rules for other reasons. Our current workaround is to revert to docusaurus v1 which works as expected.
We are having this issue too running on an Azure Webservice.
Same here, with GH Pages.
My current way to workaround that:
static/js/fix-location.js with: if (window && window.location && window.location.pathname.endsWith('/') && window.location.pathname !== '/') {
window.history.replaceState('', '', window.location.pathname.substr(0, window.location.pathname.length - 1))
}
docusaurus.config.js: scripts: [
{
src: '/js/fix-location.js',
async: false,
defer: false,
},
@dotansimha Thanks for the workaround.
Anyone else who uses this fix don't forget to include your baseUrl if your site is not hosted at the root
scripts: [
{
src: '/baseUrl/js/fix-location.js',
async: false,
defer: false,
},
Hey, I found the original issue description not so easy to understand (particularly that md files are in zip files 馃お that does not help to scan this issue). To clarify the problem, here's what I understand:
/folder/myDoc/folder2/myTargetDoc/folder/folder2/myTargetDoc and to make it work in production, we would have to write [myLink](../../folder2/myTargetDoc)So this bug is only related to using relative links, is that correct @littlespex ?
Is it the problem you also encounter @davidhagg @dotansimha @cliedeman ? Or is it something else?
We should find a solution to this problem (track https://github.com/facebook/docusaurus/issues/3372), but in the meantime, possible workarounds are:
[myLink](/folder2/myTargetDoc)[myLink](../folder2/myTargetDoc.md)@slorber I believe this issue happens on any link that does not contain a trailing backslash. We had to revert to docusaurus v1, so I no longer have a working example.
Most helpful comment
My current way to workaround that:
static/js/fix-location.jswith:docusaurus.config.js: