Htaccess allow .txt files

In the web folder, I currently cannot access .txt files through the URL in the browser. How to change the htaccess file so that .txt files can be accessed via the URL in the browser?

+4
source share
3 answers

If you added settings to your .htaccess file that Sergio did not mention, you may have to go directly to your VirtualHost entry. and add the rules. I will let more experienced Apache people come here, but this is where I will go.

+2
source

Paste the code below into the htaccess file:

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

This will allow access to all txt files. If you want to refuse all but one specific file:

  Order Deny,Allow Deny from All <Files "view_only_this_file.txt"> Order Deny,Allow Allow from All </Files> 
+3
source

Thank Sergio I changed my code to allow a specific txt file:

 <Files "unternehmenscocktail.txt"> Order Deny,Allow Allow from all </Files> 
0
source

Source: https://habr.com/ru/post/1440893/


All Articles