Menu Close

How To Force Any File Download in WordPress via Htaccess

To download a file on your wordpress site without it opening in new window, we force it to download by editing the HTaccess file in the directory of the website.

In using cpanel and cant locate the file, enable show hidden files in settings

copy and paste the line of code below, you can add more file extension like pptx,mp4

<filesmatch “.(mov|mp3|jpg|pdf|png)$”>ForceType application/octet-stream Header set Content-Disposition attachment </filesMatch>