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

make LocaleMiddleware and APPEND_SLASH work better together #23

Open
benzkji opened this issue Jun 21, 2021 · 1 comment
Open

make LocaleMiddleware and APPEND_SLASH work better together #23

benzkji opened this issue Jun 21, 2021 · 1 comment
Assignees

Comments

@benzkji
Copy link
Member

benzkji commented Jun 21, 2021

want to redirect /foo AND /foo/ (obviously) to /bar/

whne LocaleMiddleware is enabled, together with i18n_patterns in urls.py, we'll have to enter two redirects, with and without slash - as /foo/ is not a valid url (as checked in CommonMiddleware, about here: https://github.com/django/django/blob/main/django/middleware/common.py#L71 ), and because of that, no redirect to /foo/ is made (but, instead, to /language/foo/).

One approach could be to check for Redirects with and without slash at the end, when there is no slash at the end of the current path. Or even try a "ignore the slash at the end" approach, making the final slah irrellevant. This would enhance usability for redirect editors, as currently, one is often forced to enter redirects with and withouth the trailing slahsh.

@benzkji
Copy link
Member Author

benzkji commented Mar 22, 2022

PAINLESS_REDIRECTS_IGNORE_TRAILING_SLASH setting?

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

No branches or pull requests

1 participant