I’ve been working on SEO setup recently for my website, used 5 to 7 various tools, all reports had common issues related to images access denied. For security reasons WordPress blocks the complete access to uploads folder which has all the images and all files in that folder
Finding the solution to it wasn’t that easy so after testing many codes, tips and tricks mentioned on the web I finally got a simple solution to this problem.
Simply open your hosting CPanel or control panel or FTP account to edit the following file from the server.
Now in the File Manger open the .htaccess file and add the following code
After the code is added simply save the file and wait for 10~15 minutes to make the changes to take effect. (Normally it will not take more than 1 min but depending on server it may take upto 15 min.)
# Allow access only to images file types (you can add/edit/delete the file types as per your requirement)
Order Allow,Deny
Allow from all
# The following code will Disallow folder accesss to public or searchengines - it is highly recomended that you keep the following code and do not change anything
RewriteEngine On
RewriteRule ^$ - [F]