This guide will walk you through the steps of making files downloadable when a link is clicked. By default, clicking on a file link (like a PDF or video) will open the file in the browser. If you wish to download the file automatically instead, you can achieve this with a simple update to your .htaccess file.
Follow the steps to force file downloads:
- Open File Manager in your hosting control panel.
- Locate and open the .htaccess file (usually found in the root directory).
- Add the following code, replacing the file extensions with the ones you want to be downloadable:
AddType application/octet-stream .avi .mpg .mov .pdf .xls .mp4
- For a specific file type only, such as PDFs, use:
AddType application/octet-stream .pdf
- Save the file after making the changes.
If it’s not working:
- Clear your browser cache, then try again.
- Make sure hosting supports .htaccess overrides.
That’s it! Visitors who click on these file links will now see a download prompt instead of the file opening in the browser. If you need any assistance, please don’t hesitate to contact our support specialists.
Need to set up custom rules? Learn How to create a new .htaccess file using cPanel’s file manager