[OT]:403 error only on .txt file, not other file types

I’m trying to link to a PGP key that I’ve placed in my /static folder. If I hugo serve I can view the file perfectly, but after deploying to the server I get a 403: Forbidden error.

I tried again, substituting a .pdf file for the .txt file, and it works fine as expected.

Is this some kind of permissions issue? Has anyone seen this before?

That’s a server issue, not Hugo. Check your .htaccess file or httpd.conf for directives that disallow that file type or file extension. Or, you may need to add a mime type in .htaccess: AddType text/plain .txt

Edited .htaccess:

<FilesMatch "\.(txt)$">
  Order Deny,Allow 
  Allow from all
</FilesMatch>

No dice. Hm.

.htaccess file usage sometimes needs to be enabled in httpd.conf. Ask your web host.

Check the file rights of the .txt file. If the server’s user account can’t read them (try 644) it can’t access them. .htaccess is only additional to that.

Also, depending on the version of your Apache server the allow,deny section has to look different:

https://httpd.apache.org/docs/2.4/upgrading.html#run-time

And lastly, but probably firstly: Make sure it’s an Apache :wink: .htaccess has only powers there.

Tihs topic is as OT as it can get. This is the Hugo Support Forum, not the one for Apache.