How to Optimize Magento for Faster Ecommerce

apache cache Community compression CSS ecommerce gzip htaccess Javascript JS Magento Magento compiler Mage_Compiler merge mod_deflate open source optimization web server

December 14th, 2012 By:

Magento is a very power and flexible open source ecommerce solution. As you may know, however, with great power comes great responsibility. Magento can be a lot for a server to handle if you have an active online business, but with some good optimization, you can have fast ecommerce and an efficient use of your newfound power.

One of the main optimizations you can perform is to modify the .htaccess file included with Magento.

Compression

Use the Apache mod_deflate module to compress any text, javascript, or css information. All modern browsers can receive and inflate compressed files. These lines should already be present in the file. Simply uncomment the ones you want to use by removing the “#” symbol.

<IfModule mod_deflate.c>

############################################

## enable apache served files compression

## http://developer.yahoo.com/performance/rules.html#gzip

# Insert filter on all content

SetOutputFilter DEFLATE

# Insert filter on selected content types only

AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css text/javascript application/javascript

# Netscape 4.x has some problems…

BrowserMatch ^Mozilla/4 gzip-only-text/html

# Netscape 4.06-4.08 have some more problems

BrowserMatch ^Mozilla/4\.0[678] no-gzip

# MSIE masquerades as Netscape, but it is fine

BrowserMatch \bMSIE !no-gzip !gzip-only-text/html

# Don’t compress images

SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip dont-vary

# Make sure proxies don’t deliver the wrong content

Header append Vary User-Agent env=!dont-vary

</IfModule>

Merge CSS and JS Files

This will reduce the amount of HTTP requests that your web server will have to answer when the CSS and javascript files are combined.

  1. Login to Mangento’s administration and find System > Configuration > Developer
  2. Find “Javascript Settings”, and choose “Yes” for “Merge Javascript Files”
  3. For “CSS Settings”, choose “Yes” for “Merge CSS Files”
  4. Clear Magento’s cache

Enable Magento Compiler

You can reduce file system reads (disk access) by enabling Mangento’s Mage_Compiler. It will copy several highly-used files into a single directory and also cache the most frequently-used pages. To do this, login to Magento admin and find System > Tools > Compilation. Then select “Run Compilation Process”.

There are many other optimizations you can perform for Mangento. See the software’s documentation and community forums for more details.

Red5 Hosting


SPONSOR SHOWCASE
Caronet Cloud - VMware Private and Public Cloud

* No Force-Fitting Configurations - Build to Your Requirements
* Enhanced Security, High Performance and Robust Infrastructure
* Fully-Redundant Architecture Built for High Reliability
* RESTful API - User Friendly & Syncs Easily with Current Programming
* Enterprise Level Support 24 x 7 x365