Thursday, May 2, 2013

Force Text Files to Download and Not Show in Your Browser using htaccess file

By default, if a text file (.txt) is requested, the contents of the file is shown in the browser and is not downloaded. This is because the default MIME type for .txt files specifies to show the files and not download them. You can however change this by adding the line below:
AddType application/octet-stream txt
Be warned though, every .txt file in the current directory and any subdirectories will be affected.
Disqus Comments