Answer the question
In order to leave comments, you need to log in
Forced download of a file instead of viewing it in the browser, how to do it?
Hello everyone, I need to force download files with the extension .7z on Wordpress.
There is such a trick, create a .htaccess file in the folder in which the files are located, and enter this into it.
<files *.7z>
forceType application/octet-stream
Header set Content-Disposition attachment
</files>
Answer the question
In order to leave comments, you need to log in
The issue was resolved by writing the following line in the root .htaccess:
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
AddType application/zip .zip .zip .7z
And if you go by the method of adding to the download attribute link
htmlbook.ru/html/a/download
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question