I have a multi site setup with drupal in a sub directory on root. so i have:
public_html
--drupal
--newsite (subdomain symlinks to the drupal folder)
--index.html and other static files of root.
Im working this on the subdomain to change to main domain when i go live.
I am using the boosted2.txt setup as pasted below in my newsite/.htaccess, not in the drupal folder. I tried putting the .htaccess boost code in the drupal folder, status report coughs. Now, it's in the newsite/.htaccess and status report is fine. With Cache in the newsite/cache folder, i see the files created in there fine, but does not get served.
Can someone please help me? I have been on this for 2 agonizing days : (
Settings are:
### BOOST START ###
# Gzip Cookie Test
RewriteRule ^(.*)boost-gzip-cookie-test\.html cache/perm/boost-gzip-cookie-test\.html\.gz [L,T=text/html,E=no-gzip:1]
# GZIP - Cached css & js files
RewriteCond %{HTTP_COOKIE} !(boost-gzip)
RewriteCond %{HTTP:Accept-encoding} !gzip
RewriteRule .* - [S=2]
RewriteCond %{DOCUMENT_ROOT}/cache/perm/%{HTTP_HOST}%{REQUEST_URI}_\.css\.gz -s
RewriteRule .* cache/perm/%{HTTP_HOST}%{REQUEST_URI}_\.css\.gz [L,QSA,T=text/css,E=no-gzip:1]
RewriteCond %{DOCUMENT_ROOT}/cache/perm/%{HTTP_HOST}%{REQUEST_URI}_\.js\.gz -s
RewriteRule .* cache/perm/%{HTTP_HOST}%{REQUEST_URI}_\.js\.gz [L,QSA,T=text/javascript,E=no-gzip:1]
# NORMAL - Cached css & js files
RewriteCond %{DOCUMENT_ROOT}/cache/perm/%{HTTP_HOST}%{REQUEST_URI}_\.css -s
RewriteRule .* cache/perm/%{HTTP_HOST}%{REQUEST_URI}_\.css [L,QSA,T=text/css]
RewriteCond %{DOCUMENT_ROOT}/cache/perm/%{HTTP_HOST}%{REQUEST_URI}_\.js -s
RewriteRule .* cache/perm/%{HTTP_HOST}%{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 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 %{HTTPS} on
RewriteRule .* - [S=7]
# GZIP
RewriteCond %{HTTP_COOKIE} !(boost-gzip)
RewriteCond %{HTTP:Accept-encoding} !gzip
RewriteRule .* - [S=3]
RewriteCond %{DOCUMENT_ROOT}/cache/normal/%{HTTP_HOST}%{REQUEST_URI}_%{QUERY_STRING}\.html\.gz -s
RewriteRule .* cache/normal/%{HTTP_HOST}%{REQUEST_URI}_%{QUERY_STRING}\.html\.gz [L,T=text/html,E=no-gzip:1]
RewriteCond %{DOCUMENT_ROOT}/cache/normal/%{HTTP_HOST}%{REQUEST_URI}_%{QUERY_STRING}\.xml\.gz -s
RewriteRule .* cache/normal/%{HTTP_HOST}%{REQUEST_URI}_%{QUERY_STRING}\.xml\.gz [L,T=text/xml,E=no-gzip:1]
RewriteCond %{DOCUMENT_ROOT}/cache/normal/%{HTTP_HOST}%{REQUEST_URI}_%{QUERY_STRING}\.json\.gz -s
RewriteRule .* cache/normal/%{HTTP_HOST}%{REQUEST_URI}_%{QUERY_STRING}\.json\.gz [L,T=text/javascript,E=no-gzip:1]
# NORMAL
RewriteCond %{DOCUMENT_ROOT}/cache/normal/%{HTTP_HOST}%{REQUEST_URI}_%{QUERY_STRING}\.html -s
RewriteRule .* cache/normal/%{HTTP_HOST}%{REQUEST_URI}_%{QUERY_STRING}\.html [L,T=text/html]
RewriteCond %{DOCUMENT_ROOT}/cache/normal/%{HTTP_HOST}%{REQUEST_URI}_%{QUERY_STRING}\.xml -s
RewriteRule .* cache/normal/%{HTTP_HOST}%{REQUEST_URI}_%{QUERY_STRING}\.xml [L,T=text/xml]
RewriteCond %{DOCUMENT_ROOT}/cache/normal/%{HTTP_HOST}%{REQUEST_URI}_%{QUERY_STRING}\.json -s
RewriteRule .* cache/normal/%{HTTP_HOST}%{REQUEST_URI}_%{QUERY_STRING}\.json [L,T=text/javascript]
### BOOST END ###
Comments
Comment #1
jumoke commentedI have used other methods, from pasting the Boost rules from the performance page and tried every combination of the settings, no luck. please help.
Comment #2
wobbler commentedI haven't run Apache for years so I don't know specifics, but I would just do the normal things to check where the process is failing. The static files are being generated so that means that Boost is working ok, the problem is with the Apache config.
The first first thing to do is to make sure you are not using a logged in browser session. When working with boost rules I use firefox or chrome logged in and use IE not logged in. As I don't use IE all the time I can clear the cache as many times as I want without losing my browsing history etc.
What happens if you directly access the static page?
ie. http://www.example.com/newsite/cache/normal/www.example.com/_.html
Is mod_rewrite activated for the newsite location??
I am not sure what the default behaviour of Apache is these days, or what your config is but you need to make sure that Apache is configured to read htaccess files in each subdirectory. It can be configured so it will only read from the config files at start up, you need it to look for htaccess files each time it accesses a subdirectory. From memory I think that is one of the Options directives.
Setup a seperate access log for the newsite location to ensure that apache is serving the files from under that sub directory and not from the drupal directory, as you said it is a symlink I believe that there is an Option directive that can make Apache work back through symlinks to the original directory, which could make it use a different htaccess config maybe??
The access log should log all the varables you are using in the htaccess, document_root request_uri http_host etc. you may need to use the boosted1.txt instead?
If all that looks ok then you need to setup an error log to debug the rewrite rules.
Comment #3
wobbler commentedYou do have the document_root set correctly for the subdomain newsite? If not the rules should be
RewriteCond %{DOCUMENT_ROOT}/newsite/cache/normal/%{HTTP_HOST}%{REQUEST_URI}_%{QUERY_STRING}\.html -sOnce you are sure that Apache is serving the files from under the newsite directory, is picking up the directory based htaccess file and you have the access logs logging the requests coming in I would also reduce the number of rules to start with too.
To test that the html file is being served you only need the first two lines of the #NORMAL section, once you get that working properly then you can start building up the normal css and js, then the gzip rules should follow.
More than likely there will be something in your main apache config which is either passing the wrong http_host or stopping the htaccess file being read. Once you fix those the rules should be standard.
Comment #4
jumoke commentedHi wobbler, thank you so much for your sparing me your time and attention on this. I am very grateful!!!
To answer your questions:
I use IE normally as my anonymous browser, like you, i never log in with IE as i rarely use it so i am sure i am not logged in and i clear my IE cache everything i make a setting change.
When i access http://www.example.com/newsite/cache/normal/www.example.com/_.html, I get my file loaded perfectly.
Yes mod_rewrite is activated --> RewriteEngine On
I have tried the boosted1.txt instead again (after many times), and cleared all files and cache now and cleared browser as well. No luck, still the same effect.
*sighs, i'll setup the error logs and see
this is insane : (
Comment #5
jumoke commentedHi wobbler :)
Thanks so much again. I am indebted to you.
Here's what i have...i can send u the info in an email if u have a minute to take a look for me please? Its not super sensitive info, it's my church site
Comment #6
jumoke commentedOn the boost status block. I get
hmn...something does not exist :/ but i can navigate to http://new.excalibur.org/cache/normal/new.excalibur.org/about_.html
Comment #7
mikeytown2 commentedNote to self:
I need a better status report checking mechanism. Put a live file in the boost dir with some crazy name. Test to see if that url comes back. meta tags for no follow etc needed on test file.
Comment #8
jumoke commentedOmigod!!! I have tried everything, NO JOY. I even have all absolute links now. Still not displaying. I checked the access logs and everything seems fine. I am going to have to disable boost for now and recycle back to this another day. If anyone can think of any other ideas, please let me know. Thanks alot Wobbly for kindness
Comment #9
jumoke commentedWobbly, Mikey, may I send my login to either of you to check my setup for me please? I hate to give up on this : ( it's 2 days already.
Comment #10
mkalbere commented1) clean your browser cache to sure sure you don't have any remaining cookies
2) most certainly your variables are wrong for ex in : %{DOCUMENT_ROOT}/new/cache/normal/%{HTTP_HOST}%{REQUEST_URI}_%{QUERY_STRING}\.html\.gz -s you have to debug this, which is not easy ...
to debug I used : (ex to print the DOCUMENT_ROOT
before your rewrilerules
RewriteRule ^(.*)$ debug.php?mes=%{DOCUMENT_ROOT} [L,QSA]
in debug.php
<?php
echo $_REQUEST['mes'];
Not very clean, not very efficient .. but at least you get some info.
3) You could also hard code DOC_ROOT, HOST etc ... (but in that case it will be very hard to have a multi-site install.)
Comment #11
jumoke commentedi think it's working.....*faints*
brb
Comment #12
jumoke commentedWow...it's working now :D
mkalbere, thanks for that tip!!!
I created a phpinfo.php file in my multisite directory and put in the following to print out my info.
Then i realized SERVER['DOCUMENT_ROOT'] was printing out something shady like "usr/htdocs" wow!!! So i hard coded the absolute path to my base directory in boosted2.txt to get the following:
my .htaccess is in the multisite directory.
I added boosted rules into the drupal directory .htaccess as well, i used the boosted1.txt for that. I don't know if including boosted rules in my drupal directory has any effect all i know is that it's working and this has made my day after 3 agonizing days!!! Oh well. So in my drupal directory, i have
And now my site is flying on my multisite install.
Thank you wobbler and mkalbere for your time and attention to helping me with this. And thanks mikey for this amazing module.
Comment #13
wobbler commentedSo it looks like the document_root is not set correctly. You should set that as you may find other php scripts you use needing that to be correct.
Have a look here
http://httpd.apache.org/docs/2.2/mod/core.html#documentroot
Then you could change the rule back to use the variable rather than the hard coded path. It would make it easier if you start running more sites from the same setup.
Also this regex doesn't look correct, it is in the section trying to redirect non www. to new. ??
I would of thought that the rule would match people coming to the site using wwwnew.excalibur.org which I don't think you are trying to do. To redirect people coming to www.excalibur.org to new.excalibur.org you should use
I would not re-drect people to a non www. or new. version of the site for Drupal.
Comment #14
wobbler commentedhttp://drupal.org/node/1069182#comment-4133206
I like this tip. If Drupal admins are looking for the phpinfo() information you can get it by going to Reports -> Status Report and clicking on the link telling you the php version. At the bottom of the page is the PHP Server Variables section which should tell you all the information you need.
http://www.example.com/admin/reports/status/php
Comment #15
jumoke commentedHi Wobbler :) thank you so much for taking the time to educate me on all this. I really appreciate and have learned alot in the pain of installing this boost module. Thanks for the link, you are right...i should and will fix my document root now
In the regex: I am simply trying to remove www from the domain name: Here is what i have now?
I wonder if there is a tutorial or translation learning docs for .htacess variables somewhere you can point me to?
Comment #16
jumoke commentedHmn..Great info..on the php status link. I never knew...lol
Comment #17
mkalbere commented@Excalibur
Try this :
RewriteCond %{HTTP_HOST} ^www.*$ [NC]
RewriteRule ^(.*)$ http://YOURDOMAIN/$1 [L,R=301]
Comment #18
jumoke commentedHi mkalbere, thanks okay, i'll try that.
One other issue or concern:
When i clear the cache using the buttons on admin/settings/performance/boost and admin/settings/performance. It will show the cached pages count from whatever number of pages to now 0 pages cached, so it appears to have cleared, however the files do not get deleted from the cache folder. In other words, the physical cache files doesn't clear and the old boosted pages still get served, long after cleaning my IE browser (even/loggin in and logging off). Is this normal? I've been having to go into the cache folders to manually delete. This is time consuming
Comment #19
mkalbere commenteddid you look at your logs.
Try to delete cache (admin/settings/performance/boost) and then directly go to /admin/reports/dblog to see if anything went wrong.
Here is a small proc that empty everything .. if it can help :
function deletecachestatic(){
drupal_flush_all_caches();
boost_cache_clear_all_db();
boost_cache_delete(TRUE);
drupal_set_message('Cache cleared.');
drupal_goto();
})
Comment #20
jumoke commentedby dblog says it's working:
boost 03/07/2011 - 13:01 Flushed ALL files from static page cache. Excalibur
It seems to work, thank you
Comment #21
mkalbere commentedno it's PHP code ... so I supposed your are not a developper ... maybe the easiest (and pretty dirty also ..)
in the template.php of your theme at the beginning but after <?php
<?php
if (isset($_REQUEST['cleancache'])){
drupal_flush_all_caches();
boost_cache_clear_all_db();
boost_cache_delete(TRUE);
drupal_set_message('Cache cleared.');
drupal_goto();
}
and call any page from your site http://XXXX/?cleancache=1
don't forget to remove/comment after
Comment #22
jumoke commentedOkay thanks i'll try that.
New to php but a .net/c# developer now doing php
So this will mean that i'll have to run that code to clear my cache each time? I guess it's not so bad, better than doing it manually...thanks mk! I owe you alot :)
Comment #23
bgm commentedOld issue, closing.
For the record, we can clear cache using "admin_menu", drush, admin/settings/performance/boost or other methods. (although I did not read the whole thread to be honest)