Relative path in Create a Website style projects result in unexpected behavior with relative urls

In a Create a Website style project I have the following four files:


Each index.html has a script tag like follows (note relative url and not absolute):

<script src="script.js"></script>

If I visit “” (note no trailing slash),
then script script tag in /test/index.html does not resolve to /test/script.js but it instead resolves to /script.js.

If I visit “” (note inclusion of trailing slash), then the script tag resolves to /test/script.js as expected.

I think it would be a better experience for Create a Website style projects if visiting what resolves to a subdirectory without a trailing slash redirected to the trailing slash url to assist with relative paths.

Looks like performing the redirect is also recommended by the Google Webmasters blog and seems reasonable:

so this issue is caused because the behavior in glitch is the same as the behavior on your local file system, or a standard http server: . I’m not sure why web standards don’t just work with trailing slashes, ugh internet.

as suggested in the stack overflow answer, one thing you can do is to create a full node app and use express routing to create that redirect.

Oh for sure. I just like the simplicity of the Create a Website feature and want to get some edge cases hammered out :slight_smile: