Apache.. BLANK stare..

I discovered an interesting and potentially useful (and potentially disastrous) undocumented feature in Apache's mod_rewrite today.

I had switched to a live view of a "/readme.php" file, fully expecting to have my request rewritten to "/", when up pops the raw html view of readme.php. That's not right, I thought. Especially as I had tested that rewrite rule only minutes ago, with another readme.php in the same tree.

After a wee while scratching my head and testing, I discovered something interesting. The clue was the location. I was editing an image gallery template, which is stored in /Gallery/[BLANK]/. Slowly, it dawned on me.. Surely not..

Yes. If your path has the string "BLANK" (upper case, no quotes) in it, mod_rewrite ignore it. I know, wow!, eh?

However, for a local dev mirror templates folder (which it is) it's actually pretty handy, enabling you to view raw versions of files which are (if you use rewriting to prevent direct access to such things, as most sane webmasters do) normally hard to render without messing with your .htaccess file.

At any rate, good to know,
for now..

;o)

p.s. if anyone has the time to scout through the Apache source and figure out why this happens, please do let me know!

 ©  2024 « corz.org » 24.10.9  

Welcome to corz.org!

I'm always messing around with the back-end.. See a bug? Wait a minute and try again. Still see a bug? Mail Me!