{"id":702,"date":"2023-02-14T10:33:50","date_gmt":"2023-02-14T10:33:50","guid":{"rendered":"https:\/\/blog.hostinger.io\/support\/2023\/02\/14\/6987484-how-to-make-files-downloadable-upon-a-click-on-a-link\/"},"modified":"2023-02-14T10:33:50","modified_gmt":"2023-02-14T10:33:50","slug":"6987484-how-to-make-files-downloadable-upon-a-click-on-a-link","status":"publish","type":"post","link":"https:\/\/www.hostinger.com\/support\/6987484-how-to-make-files-downloadable-upon-a-click-on-a-link\/","title":{"rendered":"How to Make Files Downloadable Upon a Click on a Link"},"content":{"rendered":"<p class=\"no-margin\">Normally, if you click on a file URL, the file will open in the browser. Instead, you can easily force files to download upon a click.<\/p><p class=\"no-margin\">\n<\/p><p class=\"no-margin\">Access the <b><a href=\"\/support\/4548688-basic-actions-in-file-manager\" target=\"_blank\" class=\"intercom-content-link\">File Manager<\/a><\/b>, find the <b>.htaccess<\/b> file, and open it to edit. Add the snippet of code below, <b>specifying all the preferred file extensions <\/b>that you want to make downloadable upon a click on the link:<\/p><p class=\"no-margin\">\n<\/p><pre><code>&lt;FilesMatch \"\\.(avi|mpg|mov|pdf|xls|mp4)$\"&gt;<br>    ForceType application\/octet-stream<br>    Header set Content-Disposition attachment<br>&lt;\/FilesMatch&gt;<\/code><\/pre><p class=\"no-margin\">\n<\/p><p class=\"no-margin\">For example, if you&rsquo;d like to make only the .pdf files downloadable, the line of code would look like this:<\/p><p class=\"no-margin\">\n<\/p><pre><code>&lt;FilesMatch \"\\.pdf$\"&gt;<br>    ForceType application\/octet-stream<br>    Header set Content-Disposition attachment<br>&lt;\/FilesMatch&gt;<\/code><\/pre><p class=\"no-margin\">\n<\/p><p class=\"no-margin\">Save the changes, and that&rsquo;s it! If you can&rsquo;t see the changes on your live website, try <b><a href=\"\/support\/1583501-how-to-clear-cache\" target=\"_blank\" class=\"intercom-content-link\">clearing the cache<\/a><\/b>.<\/p><div class=\"intercom-interblocks-callout\" style=\"background-color: #e3e7fa80;border-color: #334bfa33\">\n<p class=\"no-margin\">Learn more: <b><a href=\"\/support\/1583395-what-to-do-if-the-htaccess-file-is-missing\" target=\"_blank\" class=\"intercom-content-link\">What to Do if the .htaccess File Is Missing?<\/a> &#128161; <\/b><\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Learn how to force file downloads using the .htaccess file<\/p>\n","protected":false},"author":581,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"include_on_kodee":true,"footnotes":""},"categories":[237],"tags":[],"class_list":["post-702","post","type-post","status-publish","format-standard","hentry","category-htaccess-file"],"hreflangs":[{"locale":"en-US","link":"https:\/\/www.hostinger.com\/support\/6987484-how-to-make-files-downloadable-upon-a-click-on-a-link\/","default":1},{"locale":"es-ES","link":"https:\/\/www.hostinger.com\/es\/support\/6987484-como-hacer-que-los-archivos-se-descarguen-al-hacer-clic-en-un-enlace-en-hostinger\/","default":0},{"locale":"fr-FR","link":"https:\/\/www.hostinger.com\/fr\/support\/6987484-comment-rendre-les-fichiers-telechargeables-en-un-clic-sur-un-lien\/","default":0},{"locale":"id-ID","link":"https:\/\/www.hostinger.com\/id\/support\/6987484-cara-membuat-file-dapat-diunduh-setelah-mengklik-tautan-di-hostinger\/","default":0},{"locale":"lt-LT","link":"https:\/\/www.hostinger.com\/lt\/support\/6987484-kaip-padaryti-kad-spustelejus-nuoroda-automatiskai-butu-atsiunciamas-failas-hostinger\/","default":0},{"locale":"pt-PT","link":"https:\/\/www.hostinger.com\/br\/support\/6987484-como-tornar-os-arquivos-disponiveis-para-download-com-um-clique-em-um-link-no-hostinger\/","default":0}],"include_on_kodee":true,"_links":{"self":[{"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/posts\/702","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/users\/581"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/comments?post=702"}],"version-history":[{"count":0,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/posts\/702\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/media?parent=702"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/categories?post=702"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/tags?post=702"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}