A question about trailing slashes

Dear all,

I know, trailing slashes are an evergreen in the forum, however, I can’t find the answer for my particular question … So, apologies for asking again about this topic.

I understand from the docs, Hugo adds trailing slashes per default. Unfortunately, this is not working for us. Please have a look at this example which can be accessed with and without trailing slash:


The page is a branch bundle with an _index.md file calling a dedicate template: ./layouts/compliance/list.html I would like to have only the canonical version with trailing slash compliance/ and get rid of the other.

Do I misunderstand the documentation or do you have any other idea why it is so?

Many thanks in advance!

Hi, both links work for me. A web serve knows what is a directory and what is a file.

with Apache you need a section to define the default document

<IfModule mod_dir.c>
    DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm
</IfModule>

for hugo you should use index.html

Thanks for your reply. We host on S3, not sure if we even have a .htaccess … However, I’ll get in touch with our OPS-Team on this and report back. Thanks again.