New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pgs.sh - relative links in subfolders with and without trailing / #115
Comments
I should add, I've done some reading about how the presence/lack of trailing slash has a semantic meaning, but in previous hosts I've used, they've not been distinguishable. |
I tried adding this to _redirects but it didn't appear to work.
Additionally, it would be quite a pain to have to manually add redirects for every folder if this were the solution. If this could be made to work in _redirects, does _redirects support regex? |
Hi! This is quite surprising behavior, but regardless of whether you add or remove the trailing slash to I took at look at the default behavior for the python http.server using your site:
The problem you described does not happen in it because when a user goes to: Netlify also enabled this 301 redirect by default: https://docs.netlify.com/routing/redirects/redirect-options/#trailing-slash The default behavior for pgs should not be surprising, so I have a feeling we are going to want to setup the |
I have a PR up, gonna test today/tomorrow and then deploy. |
Thanks - I agree that the 301 looks like the solution that most hosts land on. Appreciate the quick fix! |
I've worked up a sample project at https://josherrickson-test.pgs.sh
The project consists of the following folder structure:
Both index.html link to both images using relative paths:
If I access https://josherrickson-test.pgs.sh, I properly see the cat image and the dog image is missing.
If I access https://josherrickson-test.pgs.sh/folder/index.html, I properly see the dog image and the cat is missing.
If I access https://josherrickson-test.pgs.sh/folder/, I properly see the dog image and the cat is missing
However, if I access https://josherrickson-test.pgs.sh/folder (note the missing trailing "/"), I DO see the cat image but do NOT see the dog image.
I'm uncertain if this is an issue on my end or pgs.sh's end. This issue also arises for CSS files (that's where I originally noticed it) but made this example with images to eliminate being some CSS weirdness.
The text was updated successfully, but these errors were encountered: