Websites for sale:
Used Cars for Sale - $175 and Car Sale.
If interested drop me a line at ken@kensfi.com. Thanks!
Have questions about Toronto? Check my latest project: Ask about Toronto!
Exclude folder from htaccess rewrites on WordPress blog
A couple of months ago I tried without success to share some video files on my web domain. I created a new folder, I copied those avi files there but when pointing the browser to that files it gave me that 404 error, page not found.
I took me a while to understand that WordPress especially is rewriting the .htaccess so you no longer can use any other file, except the files accepted by WordPress on your web domain. This is why so many people are installing WordPress blog on a sub-domain or just in another folder and not directly into the root.
When using a CMS (Content Management System) like ModX or WordPress the problem you’re facing is that you’re no longer able to install a second application or to use some sort of files because the rewrites can cause 404 error.
I presented at that time an easy to implement solution for excluding of those desired files from .htaccess rewrite on a WordPress blog:
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
Today I come with a solution for excluding an entire folder from being rewritten in WordPress. The only thing you have to do is adding the following line to the previous block of code:
RewriteCond %{REQUEST_URI} !^/(foldername|foldername/.*)$
To make it work just replace “foldername” with your own that needs to be excluded from the rewrite. Here the entire block oh code you have to implement into your .htaccess files:
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} !^/(foldername|foldername/.*)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
Hint: I am using WinSCP for accessing my ftp accounts and modify .htaccess files. It’s free and is a very good tool. And, by the way in comparison with others I tried is the only one showing me .htaccess files on the server. Tried before with Total Commander (very handy tool, too) but with no success.
If you enjoyed this post, make sure you subscribe to my RSS feed!Related Posts
If you enjoyed this post, please consider to leave a comment or subscribe to the feed and get future articles delivered to your feed reader.
Please read before commenting:
I don't tolerate spam comments. Be human and polite. If you are signing as "Computer repairing", "iPhone store" or other kind of bullshits you'll be marked as spam.
USE YOUR NAME! Thanks!


Thanks, but it doens’t seem to work in WP3.0?
(that version has a bit different htaccess structure?)
for me is working just fine and I am using wp 3.0.
I’ve seen this solution a number of places, but it hasn’t worked for me. Do I need to clear the cache? does something need to activate the .htaccess file?
It just doesnt work