Google Page Speed article
Hi there,
Can someone explain me how to set up the static subdomains Leo discribed in his article about "Optimizing Contao for Google Page Speed" (http://www.contao.org/blog-reader/it...age-speed.html). I know how to create subdomains. But how pointing them to the same directory as the main domain (redirect in the .htaccess?). And where and how to use the outputFrontendTemplate hook he discribed?
Thanks for your help!
Kind regards,
Bart
Re: Google Page Speed article
First step create subdomains
Quote:
I know how to create subdomains.
well done.
Quote:
But how pointing them to the same directory as the main domain
This step is mostly done when you did create the subdomain. Thats by selecting the same document root folder for the subdmain as main domain name. i.e. If your document root folder for your main domain is folder www, then select the same folder www for your sub-domain. Now your sub-domain points to the same directory as the main domain. (This process is mainly done from your Hosting control panel)
Second Step: copy and paste this paragraph into your htaccess in the root folder (I mean here your main htaccess file. Contao's .htaccess.default).
Code:
##
# Explicitly send a 404 header if a file on st[0-9].contao.org is not
# found. This will prevent the start page (empty URL) from being loaded.
##
RewriteCond %{HTTP_HOST} ^st[0-9]\.yourDomain\.com [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* - [R=404,L]
##
# Do not dispatch dynamic resources via st[0-9].contao.org.
##
RewriteCond %{HTTP_HOST} ^st[0-9]\.yourDomain\.com [NC]
RewriteCond %{REQUEST_FILENAME} \.(php|html)$
RewriteRule .* - [R=404,L]
This is taken from Leo's htaccess under Google page speed article. ( This paragraph is not in the Leo default htaccess. Thats why you have to paste it manually there. Oh! don't forget the make changes to the domain name in htaccess, it should be yours domain name)
Step Three :
Quote:
And where and how to use the outputFrontendTemplate hook he discribed?
I really didn't knew of better idea. So i've made this small tiny module. just unzip the attachment called customHooks.zip and edit MyHooks.php, where you have to put your domain name. Just put this folder in your /system/modules folder.
Don't forget to change moo_analytics as described by Leo in his article. If you are using google analytics tool.
I hope it works, as I did to mine at http://www.song-tibet.com.
Re: Google Page Speed article
Hi Tsarma,
Thx for your reply. I've installed your customHooks module and I think it works (your modul :D )!!! Because all of the CSS (and most likely the .js) do not work anymore. He can't find the subdomains. That's because I don't have the option to point my static subdomains to the same document root my site is in. In my case it is /httpdocs. And the subdomains are in /subdomains (see attachement). My controlpanel is Plesk. So what to do? :?
Re: Google Page Speed article
Can you add a htaccess with rewrite rules on the subdomains? It is just an idea
Re: Google Page Speed article
Yes I can. Do you have a suggestion?
Re: Google Page Speed article
Hi Vascom
I am glad, at the same time sorry that its not working with the sub domain thing. To be frankly I don't have any knowledge in Plesk. But by googling I found the following link, Hope you can find something good out of it http://www.fractalizer.ru/frpost_418...nside-webroot/ or some one else in the community can help you.
Regards
Re: Google Page Speed article
Re: Google Page Speed article
Thanks Tsarma and Jaap for your help! I also contacted my hoster and they give me the solution. On Plesk controlpanel don't make subdomains but a domainalias. So I deleted the subdomains and created 3 domainaliases. Easy as it was :idea: ! Now it works.
Re: Google Page Speed article
The ability to aggregate stylesheets is a fantastic improvement for Contao, particularly as you can switch the aggregation on an off so easily. Previously I was using minfiy to do this manually, and it was a bit of a chore.
It's a shame js is not handled in a similar way!
I get a good "Page Speed" score for a skeleton site, but as soon as I start to install extensions, the score starts to drop. The main reason is that many of the extensions add there own files, Mediabox adds a js and a css (and also requires mootools-more.js) so just this one extra bit of functionality adds 3 server requests.The Imageslider and Flowplayer extensions each add their own js links in the header. In total I end up with 6 js and 2 css requests which drops mu "Page Speed" score significantly.
I'm unsure of the best way to solve this. I minify my other js files ( jQuery, Cufon etc) in to 1, but manually minifying each of the js files for the extensions and removing $this->mooScripts from the header seems a dangerous way to go?
Anyone any ideas of how best to reduce the number of js requests?
Also "Page Speed" says I should "Minify HTML", any ideas how this is accomplished?
Thanks, Gary.