Author Topic

Stefan de Bruijn

Tuesday 06 November 2007 8:33:56 am

Comment48673

Have you checked what exactly is generated in /static/site1 and static/site2?

the url http://mysite.com/index.php/site1 would translate to:
/home/www/static/index.php/site1/index.html
So first loose the 'index.php'.

I never use static cache for multiple siteaccess in one Exponential installation (easier to make multiple installations).
IF it's going to work: you have to have the siteaccess name in your url. ( like http://mysite.com/site1 and http://mysite.com/site2)

According to the instructions :
"You should only add rewrite rules for the VHOSTs for which you want to have static caching. <i>In reality, this means that for each siteaccess that you want to cache, you need a different VHOST block in the Apache configuration.</i>"

I use different rewrite rules (works for 1 siteaccess, could work if you have the siteaccess name in your url, and the /static/site1 and /static/site2 are correctly generated). Example:

RewriteEngine On
# static cache in ez
# no cache for http posts
RewriteCond   %{REQUEST_METHOD} !^POST$
# do not cache vhost admin
RewriteCond   %{HTTP_HOST} !^admin.*$
# non caching vhost for passing the static cache
RewriteCond   %{HTTP_HOST} !^nocache\.mydomain\.nl$
# Does the index.html exist in the static cache?
RewriteCond   /srv/www/dbcc/static$1/index.html -f
#rewrite to the static cache
RewriteRule   ^(.*)$  /static$1/index.html [L]

#default ez rewrites
Rewriterule ^/var/storage/.* - [L]
Rewriterule ^/var/[^/]+/storage/.* - [L]
RewriteRule ^/var/cache/texttoimage/.* - [L]
RewriteRule ^/var/[^/]+/cache/texttoimage/.* - [L]
Rewriterule ^/design/[^/]+/(stylesheets|images|javascript)/.* - [L]
Rewriterule ^/share/icons/.* - [L]
Rewriterule ^/extension/[^/]+/design/[^/]+/(stylesheets|images|javascripts?)/.* - [L]
Rewriterule ^/packages/styles/.+/(stylesheets|images|javascript)/[^/]+/.* - [L]
RewriteRule .* /index.php

If it works, you still have to make a page for 'http://mysite.com/' (or point it to one of the 2 siteaccess). you could use:

# rewrite homepage only
# check for index.html
RewriteCond   $1 =/ [OR]
RewriteCond   $1 =""
RewriteCond   /srv/www/dbcc/static/index.html -f 
RewriteRule   ^(.*)$  /static/index.html [L]
#no index.html
RewriteCond   $1 =/ [OR]
RewriteCond   $1 =""
RewriteRule   ^(.*)$  /index.php [L]

You could make a page for letting the visitor choose the siteaccess and point your homepage there

..
RewriteCond   /srv/www/dbcc/static/site1/choose/index.html -f 
RewriteRule   ^(.*)$  /static/site1/choose/index.html [L]
..
RewriteRule   ^(.*)$  /site1/choose/index.php [L]