Raising the Bar: An Internet Marketing Blog for Lawyers.

Blogging on Law Firm, Professionals and Business Web Design

Peter Boyd

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




Categories:

About Us

PaperStreet creates new web sites and revitalizes aging ones. In addition to creating web sites that are engaging, we also have a knack for getting results.

Read More »



Featured Portfolio:

View All
Contact Us