- Zikula Discussion Group
- Zikula IRC Channel (irc.oftc.net #zikula)
- Wiki Documentation
- The Zikulan
First, if you are wondering what the advantage is, it is rather quite simple. Prototype and Script.aculo.us are very common frameworks. It makes little sense that every time a browser needs one of these popular frameworks that it needs to download it and cache it to your browser. How many copies does your browser needed? Probably just one, as you have guessed. This means every time that a framework is requested from Google, your browser already has it cached, reducing the need for another HTTP request.
But not only is this an advantage to your browser, it also is an advantage to your server, as it less files it has to serve. Less files equates to less server usage and less bandwidth.
We know that Zikula requests these dynamically, and we really do not want to hack the core files to make the redirects, so a simple work around is to have Apache make use of mod_rewrite with an .htaccess file. To keep it simple we will use the .htaccess file at the Zikula root directory.
Since .htaccess files can very with Zikula, you will have to adjust according to your situation. But It should look something like this:
# security options php_flag register_globals off php_flag magic_quotes_gpc off Options FollowSymLinks RewriteEngine On # RewriteOptions 'inherit' # Place our new rules about all the other rewrite rules RewriteRule ^javascript/ajax/prototype\.js$ http://ajax.googleapis.com/ajax/libs/prototype/1.6.0.2/prototype.js [R=301,NC,L] RewriteRule ^javascript/ajax/script.aculo.us\.js$ http://ajax.googleapis.com/ajax/libs/scriptaculous/1.8.1/scriptaculous.js [R=301,NC,L]
This makes a 301 redirect to Google. There you go a quick and dirty guide!
For more information see: http://code.google.com/apis/ajaxlibs/documentation/index.html
Enjoy,
-David Pahl
Thanks, David, your notes is unreplaceble for such lamers like me
i don't think, that giving all your statistics available to google is a good idea :)
think about it
I use this with Yahoo's YUI stuff too. You don't throw your actually statistics at google or yahoo: Fact is, that you browser realizes that it has a cached version of the files you requests and then takes that. So it gets only fetched the first time you access the file and then it's only called locally at the client.