I noticed that module don`t add lines in rules generation if enabled Etags and DefaultCharset utf-8... That working in stable 6.x-1.18 version...

I must manually add following lines in .htaccess for my boost configuration:

AddDefaultCharset utf-8
  FileETag MTime Size
  <FilesMatch "(\.html|\.html\.gz|\.xml|\.xml\.gz|\.json|\.json\.gz)$">
    <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 .xml
    AddCharset utf-8 .css
    AddCharset utf-8 .js
    AddCharset utf-8 .json
    AddEncoding gzip .gz
  </IfModule>
  <FilesMatch "(\.html|\.html\.gz)$">
    ForceType text/html
  </FilesMatch>
  <FilesMatch "(\.xml|\.xml\.gz)$">
    ForceType text/xml
  </FilesMatch>
  <FilesMatch "(\.json|\.json\.gz|\.js|\.js\.gz)$">
    ForceType text/javascript
  </FilesMatch>
  <FilesMatch "(\.css|\.css\.gz)$">
    ForceType text/css
  </FilesMatch>

Comments

mikeytown2’s picture

They get placed in a cache dir .htaccess file. I need to create an option to have an all in one option like the old way.

mladenu’s picture

Yes, i saw that, but except "FileETag MTime Size"... Do that option Mike! :) Regards!

armyofda12mnkeys’s picture

Version: 6.x-1.x-dev » 6.x-1.21

Is this still an issue?

i went from 6.x-.1.18 to 6.x-1.21 today. and noticed the 'Add "AddDefaultCharset utf-8" to the htaccess rules' checkbox on the settings page doesn't add the 'AddDefaultCharset utf-8' line to the .boost .htaccess generated rules page.

Also have the .htaccess rules gotten simpler?
It went from this (under 6.x-1.18):

### BOOST START ###########################################################################################################################
  AddDefaultCharset utf-8
  <FilesMatch "(\.html|\.html\.gz)$">
    <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 .css
    AddCharset utf-8 .js
    AddEncoding gzip .gz
  </IfModule>
  <FilesMatch "(\.html|\.html\.gz)$">
    ForceType text/html
  </FilesMatch>
  <FilesMatch "(\.js|\.js\.gz)$">
    ForceType text/javascript
  </FilesMatch>
  <FilesMatch "(\.css|\.css\.gz)$">
    ForceType text/css
  </FilesMatch>
  # Gzip Cookie Test
  RewriteRule boost-gzip-cookie-test\.html  cache/perm/boost-gzip-cookie-test\.html\.gz [L,T=text/html]
  # GZIP - Cached css & js files
  RewriteCond %{HTTP_COOKIE} !(boost-gzip)
  RewriteCond %{HTTP:Accept-encoding} !gzip
  RewriteRule .* - [S=2]
  RewriteCond %{DOCUMENT_ROOT}/cache/perm/%{SERVER_NAME}%{REQUEST_URI}_\.css\.gz -s
  RewriteRule .* cache/perm/%{SERVER_NAME}%{REQUEST_URI}_\.css\.gz [L,QSA,T=text/css]
  RewriteCond %{DOCUMENT_ROOT}/cache/perm/%{SERVER_NAME}%{REQUEST_URI}_\.js\.gz -s
  RewriteRule .* cache/perm/%{SERVER_NAME}%{REQUEST_URI}_\.js\.gz [L,QSA,T=text/javascript]
  # NORMAL - Cached css & js files
  RewriteCond %{DOCUMENT_ROOT}/cache/perm/%{SERVER_NAME}%{REQUEST_URI}_\.css -s
  RewriteRule .* cache/perm/%{SERVER_NAME}%{REQUEST_URI}_\.css [L,QSA,T=text/css]
  RewriteCond %{DOCUMENT_ROOT}/cache/perm/%{SERVER_NAME}%{REQUEST_URI}_\.js -s
  RewriteRule .* cache/perm/%{SERVER_NAME}%{REQUEST_URI}_\.js [L,QSA,T=text/javascript]
  # Caching for anonymous users
  # Skip boost IF not get request OR uri has wrong dir OR cookie is set OR request came from this server OR https request
  RewriteCond %{REQUEST_METHOD} !^(GET|HEAD)$ [OR]
  RewriteCond %{REQUEST_URI} (^/(admin|cache|misc|modules|sites|system|openid|themes|node/add))|(/(comment/reply|edit|user|user/(login|password|register))$) [OR]
  RewriteCond %{HTTP_COOKIE} DRUPAL_UID [OR]
  RewriteCond %{HTTP:Pragma} no-cache [OR]
  RewriteCond %{HTTP:Cache-Control} no-cache [OR]
  RewriteCond %{HTTPS} on
  RewriteRule .* - [S=3]
  # GZIP
  RewriteCond %{HTTP_COOKIE} !(boost-gzip)
  RewriteCond %{HTTP:Accept-encoding} !gzip
  RewriteRule .* - [S=1]
  RewriteCond %{DOCUMENT_ROOT}/cache/normal/%{SERVER_NAME}%{REQUEST_URI}_%{QUERY_STRING}\.html\.gz -s
  RewriteRule .* cache/normal/%{SERVER_NAME}%{REQUEST_URI}_%{QUERY_STRING}\.html\.gz [L,T=text/html]
  # NORMAL
  RewriteCond %{DOCUMENT_ROOT}/cache/normal/%{SERVER_NAME}%{REQUEST_URI}_%{QUERY_STRING}\.html -s
  RewriteRule .* cache/normal/%{SERVER_NAME}%{REQUEST_URI}_%{QUERY_STRING}\.html [L,T=text/html]
  ### BOOST END ###########################################################################################################################

to this (6.x-1.21):

  ### BOOST START ###

  # NORMAL - Cached css & js files
  RewriteCond %{DOCUMENT_ROOT}/cache/perm/%{SERVER_NAME}%{REQUEST_URI}_\.css -s
  RewriteRule .* cache/perm/%{SERVER_NAME}%{REQUEST_URI}_\.css [L,QSA,T=text/css]
  RewriteCond %{DOCUMENT_ROOT}/cache/perm/%{SERVER_NAME}%{REQUEST_URI}_\.js -s
  RewriteRule .* cache/perm/%{SERVER_NAME}%{REQUEST_URI}_\.js [L,QSA,T=text/javascript]

  # Caching for anonymous users
  # Skip boost IF not get request OR uri has wrong dir OR cookie is set OR request came from this server OR https request
  RewriteCond %{REQUEST_METHOD} !^(GET|HEAD)$ [OR]
  RewriteCond %{REQUEST_URI} (^/(admin|cache|misc|modules|sites|system|openid|themes|node/add|comment/reply))|(/(edit|user|user/(login|password|register))$) [OR]
  RewriteCond %{HTTP:Pragma} no-cache [OR]
  RewriteCond %{HTTP:Cache-Control} no-cache [OR]
  RewriteCond %{HTTPS} on [OR]
  RewriteCond %{HTTP_COOKIE} DRUPAL_UID
  RewriteRule .* - [S=1]

  # NORMAL
  RewriteCond %{DOCUMENT_ROOT}/cache/normal/%{SERVER_NAME}%{REQUEST_URI}_%{QUERY_STRING}\.html -s
  RewriteRule .* cache/normal/%{SERVER_NAME}%{REQUEST_URI}_%{QUERY_STRING}\.html [L,T=text/html]

  ### BOOST END ###
Anonymous’s picture

Status: Active » Postponed (maintainer needs more info)

i went from 6.x-.1.18 to 6.x-1.21 today. and noticed the 'Add "AddDefaultCharset utf-8" to the htaccess rules' checkbox on the settings page doesn't add the 'AddDefaultCharset utf-8' line to the .boost .htaccess generated rules page.

You need to be looking at the rules generated in cache/normal/ not the rules generated for the root .htaccess.

armyofda12mnkeys’s picture

Hey Philip_Clarke,
Thanks for quick followup...
I dont see a generated .htaccess file under/home/mysite.com/cache/normal (do see it under /home/mysite.com/cache/ though)..
Anyway, why wouldnt the generated .htaccess rule file under /home/mysite.com/cache/ be the same as what i see under the Boost admin rule generation page: admin/settings/performance/boost-rules

I assume I should copy what I see on that admin/settings/performance/boost-rules page, vs looking on the file system?

Thanks,
-Arian

armyofda12mnkeys’s picture

and just wanted to clarify... Im not looking at the sites .htaccess file. Im just looking for the BOOST generated .htacess rules to put into that.
But i see differences from my old root .htaccess file BOOST section, and the admin/settings/performance/boost-rules page.

Anonymous’s picture

Category: bug » support

You've listed two issues.

  1. The .htaccess file in the cache folder would contain the UTF-8 command, boost writes out the rules for that folder by itself so that it can deliver plain text, adds a bit of security, adds some headers if the correct apache modules are installed. If you check the box and boost does not add the default characterset to the .htaccess in cache folder (not the root) then that would be an issue.
  2. The rules that are displayed in the text box are the ones that go in the web root/ drupal root .htaccess file. Please just list the differences between your root .htaccess boost rules and the ones you have in the text box.
  3. But i see differences from my old root .htaccess file BOOST section, and the admin/settings/performance/boost-rules page.

armyofda12mnkeys’s picture

whoops. K I realize now characterset only should get added to cache/.htaccess ... I might have manually added that 'AddDefaultCharset utf-8' line to the root/.htaccess file

For the 2nd issue (should i open a new Issue here?)...
yes, my original post has listed 1st: the root/.htaccess file which i thought I got generated from the old 6.x-1.18 module.
and 2nd: the admin/settings/performance/boost-rules output currently from 6.x-1.21 module which I am debating putting into the root/.htaccess file (but such a large difference between them, that I got scared).

For example, the boost-gzip-cookie-test.html line and the .gz stuff above it is not in the new generated code.

Anonymous’s picture

Please just post the differences from the root .htaccess files from

### BOOST START ###

etc...

### BOOST END ###

and I'll highlight anything that seems unusual/ inappropriate.

regarding the UTF-8 matter, it's a little risky placing it in the root .htaccess. The reasons are multiple although UTF-8 has been around a long time, the backend of MySQL can be in Latin-1 or a variety of character sets. Likewise with forms and data entry where HTML and browsers didn't really have any uniformity about which character set was being used, and then there are the drupal modules themselves that may have been edited and output information in ASCII, plus the inclusion of javascript that could very well have been edited in an entirely differing character set. One can be fairly sure that when all combined together and then saved out into the cache that UTF-8 is going to be the standard and so the header is valid but in the root .htaccess file I'd avoid it.

armyofda12mnkeys’s picture

Here are the main diffs:

Old one produces this at the beginning:

  AddDefaultCharset utf-8
  <FilesMatch "(\.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 .css
    AddCharset utf-8 .js
  </IfModule>
  <FilesMatch "(\.html)$">
    ForceType text/html
  </FilesMatch>
  <FilesMatch "(\.js)$">
    ForceType text/javascript
  </FilesMatch>
  <FilesMatch "(\.css)$">
    ForceType text/css
  </FilesMatch>

and also new one produces this:

  ... [OR]
  RewriteCond %{HTTP_COOKIE} DRUPAL_UID

...

I figured out that this one diff is dynamically based on turning on Gzip compression in Drupal's Boost Performance page... so thats one of main reasons there were this major diff below between upgrades (as I turned Drupal Boost Gzip Compression off since Apache already has it on.):

Old one had this... but new one adds same kinda code if turn on compression. Whoops didn't think about that when I posted question.:

  # Gzip Cookie Test
  RewriteRule boost-gzip-cookie-test\.html  cache/perm/boost-gzip-cookie-test\.html\.gz [L,T=text/html]
  # GZIP - Cached css & js files
  RewriteCond %{HTTP_COOKIE} !(boost-gzip)
  RewriteCond %{HTTP:Accept-encoding} !gzip
  RewriteRule .* - [S=2]
  RewriteCond %{DOCUMENT_ROOT}/cache/perm/%{SERVER_NAME}%{REQUEST_URI}_\.css\.gz -s
  RewriteRule .* cache/perm/%{SERVER_NAME}%{REQUEST_URI}_\.css\.gz [L,QSA,T=text/css]
  RewriteCond %{DOCUMENT_ROOT}/cache/perm/%{SERVER_NAME}%{REQUEST_URI}_\.js\.gz -s
  RewriteRule .* cache/perm/%{SERVER_NAME}%{REQUEST_URI}_\.js\.gz [L,QSA,T=text/javascript]
Anonymous’s picture

DRUPAL_UID is a cookie to ensure that the served pages are for anonymous users only. Sometimes it gets triggered by modules that don't set their own cookies for data storage and use a dummy drupal session (alas nothing that we can do about other modules that don't follow the guidelines and modify drupal core features).

I would suggest testing gzip compression very carefully and checking the bug list for the known issues revolving around mod_mime and mod_headers, there are combinations that unfortunately mean that with chrome in particular the filesize header goes awry and sends and the browser displays just a blank page.

Personally I would also avoid the compressed css and javascript and turn on mod_deflate which adds more cpu cycles but is more stable and less pache module configuration dependent.