httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John Rowe <>
Subject [PATCH] mod_rewrite Content-Regeneration
Date Fri, 16 Apr 2004 21:47:20 GMT
First of all, thanks for all the effort that goes into apache. We
switched from NCSA to apache1 longer ago than I like to remember..

The rewriting guide has a short section called "On-the-fly
Content-Regeneration" but it's actually just "Generation" as there's no
way for the server to know if the page needs to be regenerated. To my
mind this somewhat limits the usefulness of the '-s' switch. I need the
ability to have an 'options' file and for mod_rewrite to update the
generated file in a make-like fashion whenever the options file changes,
rather than the collection of kludges I used to have. 

So I've added an option ('mtime|M') to RewriteCond that causes the
expression to be treated as two filenames:

RewriteCond genfile <optionfile [M]

is True if the modification time of genfile is less than optionfile.
Since I figure that options files are, well, optional it defaults to
being True if genfile and optionfile both don't exist and I've put in an
option 'exist|X' so that:

RewriteCond genfile <optionfile [M,X]

is only True if optionfile exists and is newer than genfile.

The result is that I have a per-directory file that controls the header
and sidebar and when I change it apache now updates my static include
file for me. (I could have just made everything dynamic with php but
we've always been speed freaks and I hate doing anything that stops
caching.) If I want to I can also tell my server to put the w3c 'tick'
logo on a page only if it's been validated since it last changed which
helps my QA no end.

Of course I've added a test to check for incompatible options.

It's changed our web server, hope you like it. If it's accepted I'll
happily write some docs. I've made separate patches for
mod_rewrite.[ch], both against 2.49.



Dr John Rowe
School of Physics
University of Exeter

View raw message