From 5a490a05467281e96289ea44e4a2849452321275 Mon Sep 17 00:00:00 2001
From: Garvin Hicking <mail@garv.in>
Date: Mon, 2 Jun 2008 07:37:48 +0000
Subject: [PATCH]     * Default .htaccess now contains a conditional rewrite
 pattern       for fallback *.html generation. Thanks to absynth.       (TODO:
 Regenerate .htaccess on update, maybe make this        condition optional)

---
 docs/NEWS                            | 5 +++++
 include/tpl/htaccess_cgi_rewrite.tpl | 1 +
 include/tpl/htaccess_rewrite.tpl     | 1 +
 3 files changed, 7 insertions(+)

diff --git a/docs/NEWS b/docs/NEWS
index 954bf160..2c5ff186 100644
--- a/docs/NEWS
+++ b/docs/NEWS
@@ -3,6 +3,11 @@
 Version 1.4 ()
 ------------------------------------------------------------------------
 
+    * Default .htaccess now contains a conditional rewrite pattern
+      for fallback *.html generation. Thanks to absynth.
+      (TODO: Regenerate .htaccess on update, maybe make this
+       condition optional)
+      
     * Update to Spartacus to support custom mirrors (garvinhicking)
 
     * Added possibility to access more SQL query parts of fetchEntries
diff --git a/include/tpl/htaccess_cgi_rewrite.tpl b/include/tpl/htaccess_cgi_rewrite.tpl
index 67930154..76e6e203 100644
--- a/include/tpl/htaccess_cgi_rewrite.tpl
+++ b/include/tpl/htaccess_cgi_rewrite.tpl
@@ -23,6 +23,7 @@ RewriteRule ^{PAT_PLUGIN} {indexFile}?url=$1/$2 [L,QSA]
 RewriteRule ^{PAT_SEARCH} {indexFile}?url=/{PATH_SEARCH}/$1 [L,QSA]
 RewriteRule ^{PAT_COMMENTS} {indexFile}?url=/{PATH_COMMENTS}/$1 [L,QSA]
 RewriteRule ^{PAT_CSS} {indexFile}?url=/$1 [L,QSA]
+RewriteCond %{REQUEST_URI} !-U
 RewriteRule ^index\.(html?|php.+) {indexFile}?url=index.html [L,QSA]
 RewriteRule ^htmlarea/(.*) htmlarea/$1 [L,QSA]
 RewriteRule (.*\.html?) {indexFile}?url=/$1 [L,QSA]
diff --git a/include/tpl/htaccess_rewrite.tpl b/include/tpl/htaccess_rewrite.tpl
index 342dae70..94d8535f 100644
--- a/include/tpl/htaccess_rewrite.tpl
+++ b/include/tpl/htaccess_rewrite.tpl
@@ -25,6 +25,7 @@ RewriteRule ^{PAT_PLUGIN} {indexFile}?url=$1/$2 [L,QSA]
 RewriteRule ^{PAT_SEARCH} {indexFile}?url=/{PATH_SEARCH}/$1 [L,QSA]
 RewriteRule ^{PAT_COMMENTS} {indexFile}?url=/{PATH_COMMENTS}/$1 [L,QSA]
 RewriteRule ^{PAT_CSS} {indexFile}?url=/$1 [L,QSA]
+RewriteCond %{REQUEST_URI} !-U
 RewriteRule ^index\.(html?|php.+) {indexFile}?url=index.html [L,QSA]
 RewriteRule ^htmlarea/(.*) htmlarea/$1 [L,QSA]
 RewriteRule (.*\.html?) {indexFile}?url=/$1 [L,QSA]