First off, this module is extremely great and works very well except for one small problem I can't figure out.

I am running multiple Drupal sites all on the same install. When I turn caching on for one of the sites it works perfectly as expected.

However, when I then go to another domain name on the same Drupal install it gives me a page not found message and uses the theme from the domain that has caching enabled.

I think It has something to do with the .htaccess because if I comment out the boost part of my .htaccess everything works fine again.

Here is my current .htaccess:

#
# Apache/PHP/Drupal settings:
#

# Protect files and directories from prying eyes.
<FilesMatch "(\.(engine|inc|info|install|module|profile|po|sh|.*sql|theme|tpl(\.php)?|xtmpl)|code-style\.pl|Entries.*|Repository|Root|Tag|Template)$">
  Order allow,deny
</FilesMatch>

# Don't show directory listings for URLs which map to a directory.
Options -Indexes

# Follow symbolic links in this directory.
Options +FollowSymLinks

# Customized error messages.
ErrorDocument 404 /index.php

# Set the default handler.
DirectoryIndex index.php

# Override PHP settings. More in sites/default/settings.php
# but the following cannot be changed at runtime.

# PHP 4, Apache 1.
<IfModule mod_php4.c>
  php_value magic_quotes_gpc                0
  php_value register_globals                0
  php_value session.auto_start              0
</IfModule>

# PHP 4, Apache 2.
<IfModule sapi_apache2.c>
  php_value magic_quotes_gpc                0
  php_value register_globals                0
  php_value session.auto_start              0
</IfModule>

# PHP 5, Apache 1 and 2.
<IfModule mod_php5.c>
  php_value magic_quotes_gpc                0
  php_value register_globals                0
  php_value session.auto_start              0
</IfModule>

# Requires mod_expires to be enabled.
<IfModule mod_expires.c>
  # Enable expirations.
  ExpiresActive On
  # Cache all files for 2 weeks after access (A).
  ExpiresDefault A1209600
  # Do not cache dynamically generated pages.
  ExpiresByType text/html A1
</IfModule>

# Various rewrite rules.
<IfModule mod_rewrite.c>
  RewriteEngine on

  # If your site can be accessed both with and without the prefix www. you
  # can use one of the following settings to force user to use only one option:
  #
  # If you want the site to be accessed WITH the www. only, adapt and
  # uncomment the following:
   RewriteCond %{HTTP_HOST} ^gunslot.com [NC]
   RewriteRule ^(.*)$ http://www.gunslot.com/$1 [L,R=301]
   RewriteCond %{HTTP_HOST} ^myonebaby.com [NC]
   RewriteRule ^(.*)$ http://www.myonebaby.com/$1 [L,R=301]
   RewriteCond %{HTTP_HOST} ^celebroad.com [NC]
   RewriteRule ^(.*)$ http://www.celebroad.com/$1 [L,R=301]
   RewriteCond %{HTTP_HOST} ^harleylot.com [NC]
   RewriteRule ^(.*)$ http://www.harleylot.com/$1 [L,R=301]
   RewriteCond %{HTTP_HOST} ^ufcspot.com [NC]
   RewriteRule ^(.*)$ http://www.ufcspot.com/$1 [L,R=301]
   RewriteCond %{HTTP_HOST} ^wweplace.com [NC]
   RewriteRule ^(.*)$ http://www.wweplace.com/$1 [L,R=301]
   RewriteCond %{HTTP_HOST} ^marvquin.com [NC]
   RewriteRule ^(.*)$ http://www.marvquin.com/$1 [L,R=301]
   RewriteCond %{HTTP_HOST} ^karemar.com [NC]
   RewriteRule ^(.*)$ http://www.karemar.com/$1 [L,R=301]
  #
  # If you want the site to be accessed only WITHOUT the www. prefix, adapt
  # and uncomment the following:
   RewriteCond %{HTTP_HOST} ^www.mofoyo.com [nc]
   RewriteRule (.*) http://mofoyo.com/$1 [R=301,L]
  # Modify the RewriteBase if you are using Drupal in a subdirectory and
  # the rewrite rules are not working properly.
  #RewriteBase /drupal

  # Rewrite old-style URLs of the form 'node.php?id=x'.
  #RewriteCond %{REQUEST_FILENAME} !-f
  #RewriteCond %{REQUEST_FILENAME} !-d
  #RewriteCond %{QUERY_STRING} ^id=([^&]+)$
  #RewriteRule node.php index.php?q=node/view/%1 [L]

  # Rewrite old-style URLs of the form 'module.php?mod=x'.
  #RewriteCond %{REQUEST_FILENAME} !-f
  #RewriteCond %{REQUEST_FILENAME} !-d
  #RewriteCond %{QUERY_STRING} ^mod=([^&]+)$
  #RewriteRule module.php index.php?q=%1 [L]

  # Rewrite rules for static page caching provided by the Boost module:
  # BOOST START
  <IfModule mod_headers.c>
    Header add Expires "Sun, 19 Nov 1978 05:00:00 GMT"
    Header add Cache-Control "no-store, no-cache, must-revalidate, post-check=0, pre-check=0"
  </IfModule>
  <IfModule mod_mime.c>
    AddCharset utf-8 .html
  </IfModule>
  RewriteCond %{REQUEST_METHOD} ^GET$
  RewriteCond %{REQUEST_URI} ^/$
  RewriteCond %{QUERY_STRING} ^$
  RewriteCond %{HTTP_COOKIE} !DRUPAL_UID
  RewriteCond %{DOCUMENT_ROOT}/cache/%{SERVER_NAME}/0/index.html -f
  RewriteRule ^(.*)$ cache/%{SERVER_NAME}/0/index.html [L]
  RewriteCond %{REQUEST_METHOD} ^GET$
  RewriteCond %{REQUEST_URI} !^/cache
  RewriteCond %{REQUEST_URI} !^/user/login
  RewriteCond %{REQUEST_URI} !^/admin
  RewriteCond %{QUERY_STRING} ^$
  RewriteCond %{HTTP_COOKIE} !DRUPAL_UID
  RewriteCond %{DOCUMENT_ROOT}/cache/%{SERVER_NAME}/0%{REQUEST_URI} -d
  RewriteCond %{DOCUMENT_ROOT}/cache/%{SERVER_NAME}/0%{REQUEST_URI}/index.html -f
  RewriteRule ^(.*)$ cache/%{SERVER_NAME}/0/$1/index.html [L]
  RewriteCond %{REQUEST_METHOD} ^GET$
  RewriteCond %{REQUEST_URI} !^/cache
  RewriteCond %{REQUEST_URI} !^/user/login
  RewriteCond %{REQUEST_URI} !^/admin
  RewriteCond %{QUERY_STRING} ^$
  RewriteCond %{HTTP_COOKIE} !DRUPAL_UID
  RewriteCond %{DOCUMENT_ROOT}/cache/%{SERVER_NAME}/0%{REQUEST_URI}.html -f
  RewriteRule ^(.*)$ cache/%{SERVER_NAME}/0/$1.html [L]
  # BOOST END

  # Rewrite current-style URLs of the form 'index.php?q=x'.
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
</IfModule>

# $Id: .htaccess,v 1.81 2007/01/09 09:27:10 dries Exp $


# Allow for large video uploads
php_value upload_max_filesize 100M
php_value post_max_size 100M
php_value output_buffering on
php_value max_execution_time 1000
php_value max_input_time 1000
php_value session.gc_maxlifetime 14400

# PHP5
# AddHandler application/x-httpd-php5 .php

Any help would be greatly appreciated.

Thanks,

Quinton

Comments

slayerment’s picture

Status: Active » Closed (fixed)

I seem to have fixed this by replacing everything with {SERVER_NAME} with {HTTP_POST} in my .htaccess :). The server name was showing my main root site while http post shows the current domain.

Arto’s picture

Title: Q: Multisite having issues with .htaccess settings » Multisite and .htaccess: HTTP_HOST vs SERVER_NAME
Assigned: Unassigned » Arto

Hmm, you probably mean HTTP_HOST, right?

I think we moved from using HTTP_HOST to using SERVER_NAME sometime earlier in the evolution of this module, but I don't recall the exact reason off-hand. Probably hosting setups simply vary enough that neither method will be fully satisfactory to 100% of the module's users.

I'll have to see about maybe providing another pre-rolled .htaccess file which would use HTTP_HOST. Thanks for reporting the problem & fix!

BioALIEN’s picture

Status: Closed (fixed) » Fixed

I'm not sure if this is related to apache or the hosting companies. I would have imagined webhosts use the default apache configurations!

Arto’s picture

But it is. There are a multitude of ways to do virtual host setups for Apache, and the hosting companies out there have tried them all. While SERVER_NAME is the "correct way" to do the mod_rewrite rules here, but I know of servers where SERVER_NAME can't be relied upon (as the original poster discovered, also), and there was some situation/reason when HTTP_HOST could not be relied upon (though as I said, I don't recall the details just now).

slayerment’s picture

Yes, I meant HTTP_HOST. I would think this is an okay way to go since the default Drupal rewrites on the .htaccess also use HTTP_HOST.

Anonymous’s picture

Status: Fixed » Closed (fixed)