Report this

What is the reason for this report?

Whenever I edit .htaccess, I get internal server error

Posted on November 17, 2013

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.

<FilesMatch “.(pdf)$”> ForceType application/octet-stream Header set Content-Disposition attachment </FilesMatch>

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

<IfModule mod_rewrite.c> 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] </IfModule>

END WordPress



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

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.

Sorry, I am new to digital ocean here is the snippet again : <br><code> <br>FilesMatch “.(pdf)$” <br> ForceType application/octet-stream <br> Header set Content-Disposition attachment <br>/FilesMatch <br></code> <br>

Please pastebin the .htaccess file using the following command: <br><pre>cat /path/to/.htaccess | curl -F ‘sprunge=<-’ http://sprunge.us</pre>

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.