HTTPD.ini Rewrites – How to Exclude a Subfolder – Quick and Dirty
Sorry to get geeky on our blog, but this is some good code for everyone with httpd.ini files installed on their Windows servers. The question often comes up on how to exclude a certain folder or subfolders from the rewrite processing rules.
Basically, you want your rewrites to process on all folders and files, except a certain folder or folders. Well to do that it’s easy:
RewriteRule /folder-name/(.*) /folder-name/$1 [L]
Simply put in your folder name for duh … the “folder-name” and it will exclude that from processing. Technically, I don’t think it excludes, but really processes it to write the same path. However, it works and that is all that matters for rewrites. You might have a slight speed increase if you can figure out the complex way of actually conditionally excluding folders and setting all the paths. So far, this is the quick and dirty way of doing that.
So two real-world examples are for excluding your blog and images directory:
RewriteRule /blog/(.*) /blog/$1 [L]
RewriteRule /images/(.*) /images/$1 [L]
If you wanted to exclude your blog or images directory from running rewrites that are also processing, use that code. Put this above any other rules that are processing, so it runs first and stops (the “L” means last rule).
About Us
Did you know more than 200 clients have worked with PaperStreet for more than 10 years?