Alexander Conroy

Speed Up Magento – Even on Godaddy!

I found this tidbit while beginning my Magento Journey. Turns out you can speed up the frontend of Magento with a couple of lines of code. Credit goes to Tomislav Bilic at Inchoo
Most of this involves your .htaccess file. The .htaccess file is used when you want to use apache server commands. Often webhosts will leave a htaccess.txt in your directory which pretty much does nothing as far as I’m concerned, except make you feel like an idiot when you realize you left it in the directory after setting up your .htaccess. Windows doesnt like making file names with extensions only so your best bet is to create or rename the file via FTP and download it for your editing pleasure. Notepad++ and Dreamweaver work great for editing .htaccess.
Do NOT forget to delete htaccess.txt when using .htaccess or it will not function.
On to the Fix:
Head on into your .htaccess file to edit the following. What needs to be uncommented is highlighted in red.

 

############################################
## enable apache served files compression
## http://developer.yahoo.com/performance/rules.html#gzip

# Insert filter
SetOutputFilter DEFLATE

# 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

# enable resulting html compression
php_flag zlib.output_compression on

 

Doing this should give you an immediate performance increase. My pages load now in abtou 3 – 8 seconds. Still slow, but alot better than 15 seconds+.
Hope this helps!