Question
Whenever I edit .htaccess, I get internal server error
I am trying to force PDFs to download and not open in user browser so I add this snippet to .htaccess but it causes internal server error.
ForceType application/octet-stream
Header set Content-Disposition attachment
I used this code before on shared hosting. Plus I tried other snippets but it seems like when ever I edit .htaccess from console or ftp it causes internal server error.
My default working .htacces with 664 permission
# BEGIN WordPress
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
# add a trailing slash to /wp-admin
RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(wp-(content|admin|includes).*) $2 [L]
RewriteRule ^([_0-9a-zA-Z-]+/)?(.*\.php)$ $2 [L]
RewriteRule . index.php [L]
# END WordPress
Add a comment
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
×