[SOLVED] PDF Not Downloading in WordPress

Recently, a client has a problem with his website when it comes to downloading files. The client had a PDF document that he’d uploaded and linked to it on a page for people to download.

The problem is that when people clicked the link to download the PDF file, they got a 404-error message.

What was the problem?

If you have this issue, here are a couple of possible solutions you can try.

i) Make sure you are linking to the right file. Check your link and make sure it’s leading to the right file.

ii) Check that you have uploaded the file to your website or WordPress library. If the file is huge, you may want to upload it using FTP or through cPanel. The WordPress upload function sometimes acts up.

iii) Check your htaccess file. This is what was the problem in my client’s case. Make sure there are no rules blocking downloading of files. In my client’s case, his htaccess file looked like this:


<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule !(js|ico|gif|jpg|png|css|swf|flv|libraries|maint|admin|login|logout|reg) index.php [QSA,L]

# 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]

# END WordPress

To make the files downloadable, I simply removed the top rules in the htaccess file.

<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule !(js|ico|gif|jpg|png|css|swf|flv|libraries|maint|admin|login|logout|reg) index.php [QSA,L]


If removing the above does not work in your case, you can add the following rules to the htaccess code;

<FilesMatch “\.(gz|pdf|zip|rar)$” >
Order allow,deny
Allow from all
Satisfy any

That’s it folks. If this post helped you and would like to buy me a cup of coffee, you can do so below:

[SOLVED] PDF Not Downloading in WordPress 1

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Get more tech stuff like this
in your inbox

Subscribe to our mailing list for occasional amazing tech stuff.

Thank you for subscribing.

Something went wrong.