When is the missing support of urls without a trailing slash an issue?

I read a lot about the “add support of urls without a trailing slash” issue (discourse, GitHub issue).

I would like to know if this issue can be fixed if you have access to your NGINX or Apache configuration?

After reading through the discussion I was worried that there is no solution…which is hard to belief. So if I am right, then this is “only” (sorry guys) a problem for people without access to their server configuration. Am I right?

use render hooks!

With render-link.html you can modify the URLs as you like it!

Render hooks will, in general, not help you with that.

URLs in Hugo, unless “uglyfied”, comes with a trailing slash. I’m not aware of any web server that does not support that.

To answer the question of this post’s subject line: Never.

https://blafasel.com/something and https://blafasel.com/something/ are the same. The argumentation in the Discourse post you link is coming from a non-technical view and is wrong. If your migrated site has no slashes at the end then it will keep working with URLs that end in a slash. It’s not “philosophical” or “semantical”, it’s a technical sign for a directory. Most webservers add a slash, because it is clearer, that the something in my sample above is a directory and not a file called something with no file ending. In so far I have to say that the slash at the end is “semantical” right.

So if you want to do something atypical like removing the tyres from your car and add cubes instead, then you can do it, but people will look at you strangely.

You don’t need to access the server configuration to add cubes to your car, just use a .htaccess with some rewrite lines:

1 Like