Trailing Slash is causing trouble in url

I’ve registered all my url paths with a slash at the end. If I’m trying to reach a url without a slash it gets recognized as an unknown page. If I remove the slash in the urls the pages with slash arent found.

I’ve read about the setting APPEND_SLASH in the settings.py but it doesnt seem to work for me.

How can I proceed?

Thanks in advance.

There are urls that can be defined that are effectively going to disable APPEND_SLASH - and in general, it would be those that serve as a “catch-all” url. (Some people add these to have full control over 404-type situations.) If you have a URL like that, then you’re pretty much stuck from the Django perspective.

If you want to ensure that every URL is terminated with a slash, you could use your web server’s facilities to edit the submitted url to ensure all urls end with a ‘/’. (I know both nginx and Apache can do this, I’d guess that others could as well.)

1 Like