We are experiencing a PDF file access issue on our WordPress site.
We have a folder located below the wwwroot directory named /policies:
/site/wwwroot/policies
Newly uploaded files in the /policies directory are returning a 404 error in the browser, while pre-existing files load without any issues.
For example, here is a file that returns an error: https://www.cdsbeo.on.ca/policies/413-Progressive_Discipline.pdf
And here’s another file that loads correctly: https://www.cdsbeo.on.ca/policies/F2-3_Transcript_Requests.pdf
Both PDF files are stored in the /policies directory, so I’m unsure why one file works while the other does not.
We tried testing this issue by uploading a new PDF file to the /policies directory.. and the result was a 404 page. But as mentioned.. any pre-existing PDF file loads fine in the browser.
I think we need to make an adjustment to the .htaccess but I am unsure.
2
Answers
You need to inform WordPress that it should ignore requests to the
policies
directory. I suspect that WordPress has been made aware of the existing PDFs somehow, but you should be able to tell WordPress to ignore the entire directory.See .htaccess & WordPress: Exclude folder from RewriteRule.
It could be caused by incorrect folder permissions, so ensure directories are set to 755 and files to 644. Additionally, check the .htaccess file for any rules blocking access to PDFs and, if necessary, add a rule to allow access. Clearing your cache, especially if you’re using a caching plugin, may help recognize newly uploaded files. It’s also important to review your server configuration to ensure there are no rules or file size limits causing the issue, and confirm that the URL structure for new files matches the older ones.