Off and on over the past few years I’ve occasionally wanted to put a file/directory inside a WordPress directory and then simple get the link to that file without messing with WordPress. I follow all normal procedures only to find that when I paste the link to my file in the browser, I get a WordPress error page – not just a regular error page, but one from the WordPress install that I’m trying to avoid.
For example, here’s a basic WordPress install for a company that installs custom home organization solutions. I added the directory called PDFs where I will drop files without having to go through the WordPress media manager. Although I made a separate index page inside of PDFs, when I enter the correct filepath to either the directory or the index page, I get an 404 page inside my WordPress install.
Fortunately a bit of Googling revealed that this is an easy fix. wednesdayNC explains that a bit of code in the .htaccess file will exclude directories from WordPress rewrite engine, which is our solution.
Put an .htaccess file in the directory you want to exclude (PDFs in my case) with the following code:
# disable the rewrite engine
RewriteEngine off
and you’re set!
by Jay Frost