Htaccess and humans.txt

Just discovered that when you put your .htaccess in layouts and name it htacess (so not dot) you can use Variables like {{ .Site.BaseUrl }} for your redirects etc. It will be automatically generated as .htaccess.

Same works for humans.txt. Just put the file in the layouts folder, use Variables and generate the site. Here’s an example of humans.txt:

/* TEAM */ Owner and author: {{ }} Contact: {{ .Site.BaseURL }}contact/ Twitter: {{ }}

/* THANKS */
Software used:

/* SITE */
Language: German
Standards: HTML5, CSS3, JavaScript
Made with: Hugo -



I’m very sorry, guys, but this is not happening. I fooled myself because I still had humans.txt and .htaccess in my static directory. Sorry for the confusion.

To the development team: This could be a nice addition. I use Hugo projects as frameworks for customer projects and in case this would work I could just type the name of the customer in config.toml and Hugo would create the correct data in .htaccess and humans.txt. This is working already with robots.txt.


Hi Leo! :wave:

I tried to flag this post just now, but marked it incorrectly, so instead I’ll just make a note here, to the @moderators.

I was gonna nominate this post to be deleted or moved to #feature. It comes up in the early results for “htaccess” searches. This is a “community gardening” recommendation. :slight_smile:

If the mods are uncomfortable deleting messages, know:

  1. It is a soft-delete system, and
  2. you can make it a private message instead and that works. :sunglasses:

A post was split to a new topic: .htaccess, humans.txt with template logic

I meant for the forum search. If we hide it it won’t come up. We should at the least move your post into it’s own topic, and archive this one. :slight_smile:

1 Like