HTTPD.ini Rewrites – How to Exclude a Subfolder – Quick and Dirty

A white, rounded square logo with an abstract S-shaped design on a gradient blue and purple background.

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).

Share This

Join the Sales and Marketing News, receive our last insights, tips and best practices.

Our 7 Guarantees

Keeping 2,000+ Clients Happy Since 2001.

1
You Will Love Your Design We design to please you and your clients
2
Same-Day Support 24-hour turnaround edits during business hours
3
Free Education We provide knowledge to help you expand
4
No Hidden Charges We quote flat-rate projects
5
Own Your Site No strings attached
6
We Create Results SEO, PPC, content + design = clients
7
We Make Life Easier One agency for web, branding and marketing