How to allow pdf files to be viewed in browser

Keywords: WordPress - AWS - How to - Permissions
Description:
When i try to access a pdf file in the uploads folder, its currently giving me 404 error.
I added this code to the htaccess.conf file in wordpress/conf directory and restarted apache.

<Directory "/opt/bitnami/apps/wordpress/htdocs/wp-content/uploads">
<FilesMatch "\.(mov|mp3|jpg|pdf)$">
        <IfModule !mod_authz_core.c>
                Allow from all
        </IfModule>
        <IfModule mod_authz_core.c>
                Require all granted
        </IfModule>
</FilesMatch>
</Directory>

However, it still does not allow the pdf to be viewed.
Please advise.
Thank you
-Ravi Kumar

Hi @rkhyd79

Thanks for using Bitnami WordPress!

What are the steps you are following for posting the PDF file on your WordPress site? I have tried to replicate your issue but I can upload/post/view such files using a fresh WordPress instance (I did not have to perform any changes on it):

Here are the steps I have followed:

  1. Log in to the Administration Panel and select Media. Upload your PDF file by clicking on Add New:

  1. Create a new Post and add a new File to it:

  1. Accessing to that post and clicking on owncloud opens a new tab in my browser, where I can view the PDF file I’ve just uploaded:

Are you following a similar approach?

Best Regards,

Jose Antonio Carmona


Was my answer helpful? Click on :heart:

Hello @jcarmona,
Thank you very much for your reply.
https://prnt.sc/117s8cf
As you can see from the above screenshot, the file is present in the uploads folder, but is not accessible using the url https://cutt.ly/vcCLPoZ
So i wanted to know how to tell bitnami not to add index.php for files such as the above and allow access to download/view.
Thanks and Regards
Ravi Kumar

My pleasure @rkhyd79!

I have tried to reproduce your problem on a new Bitnami WordPress instance but still did not face any issues accessing the uploaded file (using the URL). Hence, I infer this is unrelated to the default configuration and possibly something that involves your set up:


We have a Support Tool that will gather relevant information for us to analyze your configuration and logs. Could you please execute it on the machine where the stack is running by following the steps described in the guide below?

Please note that you need to paste the code ID that is shown at the end.

Best regards,
Jose Antonio Carmona


Was my answer helpful? Click on :heart: