? boost-428942.patch
Index: boost.admin.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/boost/boost.admin.inc,v
retrieving revision 1.1.2.1.2.3.2.23
diff -u -p -r1.1.2.1.2.3.2.23 boost.admin.inc
--- boost.admin.inc	8 Jun 2009 05:09:12 -0000	1.1.2.1.2.3.2.23
+++ boost.admin.inc	8 Jun 2009 22:51:27 -0000
@@ -153,21 +153,37 @@ function boost_admin_settings($form = ar
   );
 
   // Apache .htaccess settings generation
-  $htaccess = boost_admin_generate_htaccess();
+  $htaccess = boost_admin_generate_htaccess(variable_get('boost_server_name_http_host', '%{SERVER_NAME}'), variable_get('boost_document_root', '%{DOCUMENT_ROOT}'), 'cache', 'gz', BOOST_FILE_EXTENSION);
   $form['htaccess'] = array(
     '#type'          => 'fieldset',
     '#title'         => t('Apache .htaccess settings generation'),
     '#collapsible'   => TRUE,
     '#collapsed'     => TRUE,
+    '#description'   => t('!link', array('!link' => l(t('Explanation of .htaccess variables'), 'http://www.askapache.com/htaccess/mod_rewrite-variables-cheatsheet.html'))),
   );
-  $form['htaccess']['generated'] = array(
+  $form['htaccess']['boost_server_name_http_host'] = array(
+    '#type'          => 'radios',
+    '#title'         => t('Servers URL or Name'),
+    '#default_value' => variable_get('boost_server_name_http_host', '%{SERVER_NAME}'),
+    '#options'       => array('%{SERVER_NAME}' => '%{SERVER_NAME}', '%{HTTP_HOST}' => '%{HTTP_HOST}', $_SERVER['SERVER_NAME'] => $_SERVER['SERVER_NAME'], $_SERVER['HTTP_HOST'] => $_SERVER['HTTP_HOST'],),
+    '#description'   => t('It smart to leave these as %{}, only try the last option(s) if boost is still not working.'),
+  );
+  $form['htaccess']['boost_document_root'] = array(
+    '#type'          => 'radios',
+    '#title'         => t('Document Root'),
+    '#default_value' => variable_get('boost_document_root', '%{DOCUMENT_ROOT}'),
+    '#options'       => array('%{DOCUMENT_ROOT}' => '%{DOCUMENT_ROOT}', getcwd() => getcwd()),
+    '#description'   => t('Default value %{DOCUMENT_ROOT} is highly recommened.'),
+  );
+  $form['htaccess']['boost_generated'] = array(
     '#type'          => 'textarea',
     '#title'         => t('Generated Rules'),
     '#default_value' => $htaccess,
     '#rows'          => count(explode("\n", $htaccess))+1,
-    '#description'   => 'Copy this into your .htaccess file.',
+    '#description'   => t('Copy this into your .htaccess file.'),
   );
 
+
   return $form;
 }
 
@@ -247,23 +263,27 @@ function boost_admin_themes_submit($form
  *   cache
  * @param $gzip_dir
  *   gz
+ * @param $html
+ *   html document file extention
  */
-function boost_admin_generate_htaccess($server_name = '%{SERVER_NAME}', $document_root = '%{DOCUMENT_ROOT}', $cache_dir = 'cache', $gzip_dir = 'gz') {
+function boost_admin_generate_htaccess($server_name = '%{SERVER_NAME}', $document_root = '%{DOCUMENT_ROOT}', $cache_dir = 'cache', $gzip_dir = 'gz', $html = '.html') {
 Global $base_path;
 $drupal_subdir = rtrim($base_path, '/');
+$document_root = str_replace("\\", '/', $document_root);
+$document_root = str_replace($drupal_subdir, '', $document_root );
 
   $string = <<<ETO
   ### BOOST START ###
-  <FilesMatch "\.(html.gz|html)$">
+  <FilesMatch "($html.gz|$html)$">
     <IfModule mod_headers.c>
       Header set Expires "Sun, 19 Nov 1978 05:00:00 GMT"
       Header set Cache-Control "no-store, no-cache, must-revalidate, post-check=0, pre-check=0"
     </IfModule>
   </FilesMatch>
   <IfModule mod_mime.c>
-    AddCharset utf-8 .html
+    AddCharset utf-8 $html
   </IfModule>
-  <FilesMatch "\.(html.gz)$">
+  <FilesMatch "($html.gz)$">
     AddEncoding x-gzip .gz
     ForceType text/html
   </FilesMatch>
@@ -276,12 +296,12 @@ $drupal_subdir = rtrim($base_path, '/');
 
   # GZIP
   RewriteCond %{HTTP:Accept-encoding} gzip
-  RewriteCond $document_root$drupal_subdir/$cache_dir/$gzip_dir/$server_name%{REQUEST_URI}_%{QUERY_STRING}.html.gz -f
-  RewriteRule .* $cache_dir/$gzip_dir/$server_name%{REQUEST_URI}_%{QUERY_STRING}.html.gz [L]
+  RewriteCond $document_root$drupal_subdir/$cache_dir/$gzip_dir/$server_name%{REQUEST_URI}_%{QUERY_STRING}$html.gz -s
+  RewriteRule .* $cache_dir/$gzip_dir/$server_name%{REQUEST_URI}_%{QUERY_STRING}$html.gz [L]
 
   # NORMAL
-  RewriteCond $document_root$drupal_subdir/$cache_dir/$server_name%{REQUEST_URI}_%{QUERY_STRING}.html -f
-  RewriteRule .* $cache_dir/$server_name%{REQUEST_URI}_%{QUERY_STRING}.html [L]
+  RewriteCond $document_root$drupal_subdir/$cache_dir/$server_name%{REQUEST_URI}_%{QUERY_STRING}$html -s
+  RewriteRule .* $cache_dir/$server_name%{REQUEST_URI}_%{QUERY_STRING}$html [L]
   ### BOOST END ###
 ETO;
 
