• Home
  • Articles
    • IT
      • Web Multimedia
      • Oracle
    • Social Media
    • Options
    • Miscellaneous
  • About
  • Contact
Articles IT Web Multimedia How to make Joomla Faster – Tip #1 Apache Mod_expires

How to make Joomla Faster – Tip #1 Apache Mod_expires

Sunday, 09 May 2010 15:34

Now that Google is using website speed as a “signal” in it’s ranking algorithms (see related article) it is more important than ever to make your website as fast as you can without sacrificing your quality of content. There is one simply and easy change you can make to Apache (even if your website is hosted) to make your Joomla website substantially (80%+) faster for returning visitors.

apache_mod_expires_teaser

When someone visits your website for the first time, it stands to reason that the page html, images, style sheets (css), flash swf's, etc will all have to be downloaded from your website to render your webpage in the visitor's browser. However, when someone returns to your website, it shouldn't be necessary to re-download those same images, stylesheets, flash swf files, etc.

Joomla appears to do a poor job (compared with Wordpress) of setting the browser cache expiration so that RE-downloading those same images, stylesheets, flash swf files, etc does NOT take place. The Apache mod_expires change I detail below will fix this, and this resulted in a more than 100% increase is speed for returning visitors on this website.

First measure your website performance BEFORE the change

Go to this awesome website to measure your current website performance.

  1. Go to http://www.webpagetest.org/.
  2. Click the New Test tab at the top of the page, and enter in your website URL and something in comments "Before change" perhaps.
  3. Next pick the location closest to you (for me it's Dulles, VA USA.
  4. I recommend you choose IE8 (if it's available for your location) as IE8 is the most popular browser in the world (currently at least).
  5. Check First View and Repeat View and set the number of runs to 4 so you get a reasonable average.
  6. Click Submit and wait for the test to finish (approximately 4 mins).
  7. Once the test is finished, you will see the results. Just above the "Key Optimizations" you will see Run 1 is the closest to the average load time, it may not be run 1, but which ever run it is, click it.
  8. For THIS article, we're interested in the Repeat View. Make a note of the time underneath (for example 1.826s) which is in seconds.
  9. Click on the image to the right of Repeat View to see the files that are downloaded with every repeated view. You may want to take a screen shot of it to compare with after the change. See the "before the apache mod_expires change" performance of this website below. 
  10. Before Apache Mod_expires change - Click to Enlarge

Make the Apache Mod_Expires change

  1. Locate your .htaccess file. It should be in the root of your website directory. For the vast majority of website hosting companies who use cPanel, this will be under the public_html directory.
  2. Edit the .htaccess file. If using cPanel right-hand click on the file and select Code Edit.
  3. Add the following text to the bottom of the file.
    ########## Begin Enable Caching ##########
    #
    # enable expirations
    ExpiresActive On
    # expire images after a month in the website visitor cache
    ExpiresByType image/gif "access plus 1 month"
    ExpiresByType image/png "access plus 1 month"
    ExpiresByType image/jpeg "access plus 1 month"
    ExpiresByType image/x-icon "access plus 1 month"
    # expire stylesheets and javascript after 1 week in the website visitor cache
    ExpiresByType text/css "access plus 1 week"
    ExpiresByType application/javascript "access plus 1 week"
    # expire flash and XML 1 month and 1 week respectively in the website visitor cache
    ExpiresByType application/x-shockwave-flash "access plus 1 month"
    ExpiresByType text/xml "access plus 1 week"
    #
    ########## End Enable Caching ##########
  4. Save the file and then go to your website to make sure it’s still working correctly (it definitely should be, this isn’t a controversial change).

Now measure your website performance AFTER the change

Repeat the website performance test you performed at the start of this article and compare the difference. You should see a dramatic improvement! If you do, please post your results in the comments below!

You can see the performance of this website after the Apache Mod_expires change below. 

After Apache Mod_expires change - Click to Enlarge

Please leave me a comment if you found this article useful or if you have any questions.

Share This
Email This

Comments (8)

Subscribe to this comment's feed
...
0
I think your article is fantastic, I will surely try the solution for any client feeling there website is running slow.

You can also add a point of increasing Rlimit in apache.conf, it also resolves memory limit reached issue and makes your site faster than before.

WebhostUK , May 10, 2010 | url
  • report abuse
  • +0
  • vote down
  • vote up
...
0
Thanks!

If I am using a hosting company. Do you think I would have access to apache.conf?

Gareth
Gareth , May 10, 2010 | url
  • report abuse
  • +0
  • vote down
  • vote up
...
0
the change in the .htaccess file did not work for me, I received a 500 Error smilies/sad.gif - I did the test and received 47 seconds, this is not ok, right? - the site is tooo slow :/

but thanks for the helpful article!
Michael , May 21, 2010
  • report abuse
  • +0
  • vote down
  • vote up
...
0
how do you cache a font? eot woff ttf?
brenda , January 20, 2011
  • report abuse
  • +0
  • vote down
  • vote up
...
0
I also got the 500 errors.Please help me
monika , September 15, 2011 | url
  • report abuse
  • +0
  • vote down
  • vote up
...
0
Sir terrific. site as a novice Joomla user can not tell how much is speeding up. I was very happy. Thanks again for sharing.
bahadır , January 09, 2012 | url
  • report abuse
  • +0
  • vote down
  • vote up
...
0
great results thank you smilies/wink.gif
escort , January 17, 2012 | url
  • report abuse
  • +1
  • vote down
  • vote up
...
0
Thanks for post
Deftones11 , February 11, 2012 | url
  • report abuse
  • +0
  • vote down
  • vote up

Write comment

feedShow/Hide comment form
bold italicize underline strike url image quote smile wink laugh grin angry sad shocked cool tongue kiss cry
smaller | bigger

busy
< Prev   Next >

Like us on Facebook

Recommended Articles

  • Site Map
  • Legal
  • Privacy Policy
2011 GarethHooper.com