How to create a download link for a text file

Hi guys! In this tutorial I will explain how you can easily create a download link for a text file. As you might know, you can't create a simple link <a href="text.txt"> to download a text file.

If you want to create a download link for a text file, create a simple link <a href="text.txt">Download</a>

And next, in your htaccess file add this code:

<Files "text.txt">

ForceType applicaton/octet-stream

Header set Content-Disposition attachment

</Files>

In this way you will be able to download your text.txt file!









Leave a Comment