Skip to content
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

Redirect to static files without file extensions and query parameters adds trailing slash #196

Open
t-my opened this issue Oct 8, 2020 · 1 comment

Comments

@t-my
Copy link

t-my commented Oct 8, 2020

Old url

/static/css/bundle (without a .css extension)

New url

https://newsite.com/static/css/bundle

Redirect without query parameters work as intended:

/static/css/bundle -> https://newsite.com/static/css/bundle

If you add a queryparameter, redirect will add trailing slash to the redirected address:

/static/css/bundle?p=123 -> https://newsite.com/static/css/bundle/?p=123

naturally causing 404 because the server thinks this is a path, not a file.

@marisks
Copy link
Member

marisks commented Dec 11, 2020

Why do you need a 404 handler to handle static files?
The 404 handler was not intended for the page's static file redirects. You should use the correct URL on the page instead.
The reason why slash is added to the end of URL when there is no extension - to make URLs the same. Editors often added the same URL with and without a slash at the end and it caused a lot of problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants