Summary: In apache 1.3, files that were #included in SSI were NOT subject to rewrite rules. In 2.2, they are. I discovered this after getting many "unable to include" warnings. I want to find a way to negate a rewriterule.

Background 1:

In my main public_html .htaccess, I have the following:

<IfModule mod_rewrite.c>
RewriteEngine On

RewriteCond %{REQUEST_URI} !/invalid.html
RewriteCond %{HTTP_USER_AGENT} !.*W3C_Validator.*
RewriteCond %{REQUEST_FILENAME} -f
RewriteCond /var/tmp/validator/%{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME}.isbroken !-f
RewriteRule .*\.html http://validator.gushi.org/stub?uri=http://%{SERVER_NAME}%{REQUEST_URI}&path=%{REQUEST_FILENAME} [L]
</IfModule>

What this does, in essence, is forces the wc3 validator to run on any directly-requested file. It's pretty cool, actually, and uses only filesystem metrics to ensure that a file has been validated (or that it's been marked as broken, for debugging), so you need only the stat(2) function to check, which is pretty fast.

Background part 2:

In another directory, I have a HOWTO that I've written about PGP keys. It uses mod_include to #include file=header.html and footer.html (the file was generated with markdown, so it lacks those bits).

(if you care, www.gushi.org/make-dns-cert/HOWTO.html)

With me so far?  Good.  Now for the problem, and how I worked around it.

Under apache 1.3, the #include file="header.html" would not have been subject to the above rewrite rules. By default in 2.2 it is.

I've figured out that I can add the "RewriteCond %{IS_SUBREQ} false" to this, and it fixes this problem. I could also put [NS] in that rule to fix it.

What I couldn't find anywhere is: what would I put in a RewriteRule that would basically say "Don't Rewrite!". I can set RewriteEngine Off, but that seems like a sledgehammer.

I.e. how would I disable the

"RewriteRule .*\.html"

in the parent directory and say "no, in this case just use the literal file we're being asked for." Put another way, how would I say "NoRewriteRule .*\.html"?

Another observation here would be: Apache didn't at all log the subrequest to the access/error logs, or the output of the CGI. The ONLY error I got was:

[Fri Aug 03 18:10:21 2012] [error] [client 149.20.50.7] unable to include "footer.html" in parsed file /home/danm/public_html/make-dns-cert/HOWTO.html

Which was spectacularly unhelpful.

--

--------Dan Mahoney--------
Techie,  Sysadmin,  WebGeek
Gushi on efnet/undernet IRC
ICQ: 13735144   AIM: LarpGM
Site:  http://www.gushi.org
---------------------------


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@httpd.apache.org
For additional commands, e-mail: users-h...@httpd.apache.org

Reply via email to