Page 2 of 3

Re: [HOW TO] Speed Up Page Content

Posted: Thu Oct 14, 2010 9:19 pm
by barnesnet
Thank you for some really helpful tips.
I can manage most of the points but would like some help with the first one mentioned “Enable GZipping”

I’m running my site from a shared hosting package (not my own servers) would this be a job for the server admin or is it something I need to implement via scripts etc.
I have an apache handlers menu on my control panel but can not work out how I would use the code given above.
Does this code go in the .htaccess file also?

Code: Select all

<IfModule mod_deflate.c>
<FilesMatch "\.(js|css)$">
SetOutputFilter DEFLATE
</FilesMatch>
</IfModule>
Many thanks

EDIT:
I think I have worked out that the code above gets posted in your .htaccess / htaccess.txt file. Is this correct?

Simon

Re: [HOW TO] Speed Up Page Content

Posted: Thu Oct 14, 2010 11:49 pm
by Moggin
barnesnet wrote: Does this code go in the .htaccess file also?

Code: Select all

<IfModule mod_deflate.c>
<FilesMatch "\.(js|css)$">
SetOutputFilter DEFLATE
</FilesMatch>
</IfModule>
Many thanks

EDIT:
I think I have worked out that the code above gets posted in your .htaccess / htaccess.txt file. Is this correct?

Simon
Yes, that's it. The file must be renamed .htaccess to work.

I also enabled 'compress all content' via this icon in cpanel - mine was disabled by default.
optimise_site.png

optimise_site.png (28.47 KiB) Viewed 11993 times

Hope that helps.

Re: [HOW TO] Speed Up Page Content

Posted: Fri Oct 15, 2010 12:03 am
by barnesnet
Excellent thank you, just looked and I don’t have that option on my control panel.

Right, time to setup a subdomain then.

Many thanks

Re: [HOW TO] Speed Up Page Content

Posted: Fri Oct 15, 2010 12:47 am
by Moggin
Let me know if you have any luck! One problem with an image subdomain is that unless you've got wildcard SSL (or no SSL) - it will throw a security error on the checkout pages. The OP here suggests a change to the config - I presume he means the root config - but there isn't an https option in the root config now? ???

Re: [HOW TO] Speed Up Page Content

Posted: Sat Oct 16, 2010 10:30 pm
by mtichenor
Okay so i set up a subdomain and have followed the directions and my images no longer appear when I upload the new config files.

It seems so simple and the directions seem straightforward, what could I have missed? (i have redone it a couple of times). I am using vr 1.4.9.1

Code: Select all

define('HTTP_SERVER', 'http://ozarksoffroad.com/admin/');
define('HTTP_CATALOG', 'http://ozarksoffroad.com/');
define('HTTP_IMAGE', 'http://pics.ozarksoffroad.com/');

// HTTPS
define('HTTPS_SERVER', 'http://ozarksoffroad.com/admin/');
define('HTTPS_IMAGE', 'http://pics.ozarksoffroad.com/');

// DIR
define('DIR_APPLICATION', '/home/content/m/t/i/username/html/ozarksoffroad/admin/');
define('DIR_SYSTEM', '/home/content/m/t/i/username/html/ozarksoffroad/system/');
define('DIR_DATABASE', '/home/content/m/t/i/username/html/ozarksoffroad/system/database/');
define('DIR_LANGUAGE', '/home/content/m/t/i/username/html/ozarksoffroad/admin/language/');
define('DIR_TEMPLATE', '/home/content/m/t/i/username/html/ozarksoffroad/admin/view/template/');
define('DIR_CONFIG', '/home/content/m/t/i/username/html/ozarksoffroad/system/config/');
define('DIR_IMAGE', '/home/content/m/t/i/username/html/pics.ozarksoffroad/');

Code: Select all

define('DIR_SYSTEM', '/home/content/m/t/i/username/html/ozarksoffroad/system/');
define('DIR_DATABASE', '/home/content/m/t/i/username/html/ozarksoffroad/system/database/');
define('DIR_LANGUAGE', '/home/content/m/t/i/username/html/ozarksoffroad/catalog/language/');
define('DIR_TEMPLATE', '/home/content/m/t/i/username/html/ozarksoffroad/catalog/view/theme/');
define('DIR_CONFIG', '/home/content/m/t/i/username/html/ozarksoffroad/system/config/');
define('DIR_IMAGE', '/home/content/m/t/i/username/html/pics.ozarksoffroad/');
define('DIR_CACHE', '/home/content/m/t/i/username/html/ozarksoffroad/system/cache/');
define('DIR_DOWNLOAD', '/home/content/m/t/i/username/html/ozarksoffroad/download/');
define('DIR_LOGS', '/home/content/m/t/i/username/html/ozarksoffroad/system/logs/');

Re: [HOW TO] Speed Up Page Content

Posted: Thu Oct 21, 2010 4:07 am
by mtichenor
Hello..anyone? Bueller?

Re: [HOW TO] Speed Up Page Content

Posted: Sat Oct 23, 2010 5:20 am
by Adrian666
please guys i need some help with this I followed the steps but could not get this to work... im not sure which 3rd file you mention in the tutorial i dont see any admin.php ??????????????

Re: [HOW TO] Speed Up Page Content

Posted: Tue Nov 02, 2010 7:29 am
by gmoussa73
guys i tried to to the sub-domain method...nothing happened at all....can anyone give us the step by step how to implement that?? i am using v1.4.9.1
i put /images in my root directory and copied the image folder entirely...then created a subdomain : images.mysite.com and modified config.php on both root directory and admin directory.....nothing changed..try to clear cashe also no good......i did it wrong or am i missing a step in here? my shop is very slow loading although there is not much pix , around 77 products but its slow....also if this is going to work...where to change the pix uploading directory to the new images folder created in root??
cheerz..

Re: [HOW TO] Speed Up Page Content

Posted: Thu Nov 04, 2010 6:04 am
by Adrian666
I have fixed this issue at the following thread...
http://forum.opencart.com/viewtopic.php?f=20&t=22096

Re: [HOW TO] Speed Up Page Content

Posted: Thu Nov 04, 2010 10:51 pm
by Moggin
For page speed fanatics who run their own server, Google have released an Apache module which carries out some of the pagespeed optimisations automatically
http://googlewebmastercentral.blogspot. ... aster.html

Re: [HOW TO] Speed Up Page Content

Posted: Tue Nov 16, 2010 3:28 am
by fettabachi
Here's a nice tool you can use to evaluate the compression of your pages. It works with gzip as well as deflate. http://www.gidnetwork.com/tools/gzip-test.php

Re: [HOW TO] Speed Up Page Content

Posted: Thu Nov 18, 2010 2:07 pm
by MattW
Just done the .htaccess change on mine, and ran some before and after tests (From: Gloucester, UK - IE7 - DSL)

Before:
Load Time
First View 3.592s
Repeat View 2.619s

After:
Load Time
First View 3.532s
Repeat View 0.655s

Re: [HOW TO] Speed Up Page Content

Posted: Fri Nov 19, 2010 10:02 am
by fettabachi
I tried using a subdomain for my images and everything worked except for the thumbnails used in the shopping cart. Text links appeared where the thumbnails were supposed to be.

Has anyone else experienced this?

Clean install 1.4.8b

Thanks

Re: [HOW TO] Speed Up Page Content

Posted: Fri Dec 17, 2010 3:25 am
by Qphoria
Skyhigh wrote:I

Caching
This one's really simple and just involves updating your .htaccess file.
Basically all the files your site uses (jpgs, gifs, css, js, etc) need to be able to tell your PC how long they should keep them for before checking for a new file.

If we don't tell the browse a "cache time" then it will get a fresh copy of the file every time....which means more bandwidth usage and getting a 'fresh' version of the site every time - which takes longer to load.

Google recommends (or Page Speed does) that files are cached at least a month - to be honest, this is a bit of a long time but...I'm sticking with what Google tell me ;)
Although I've left JS and CSS at 24 hours since I'm currently changing the site a lot - if you don't make many changes, set it to at least a month.
(PageSpeed and other optimisation tools through a fit about a 'small' 24-hour cache period, but hey...


Before on a 'fresh view' my site was transferring 400kb. On the second view it was still transferring 300kb.
After changing the htaccess, it dropped to 80kb.


So add this to your htaccess file :

Code: Select all


# Turn on Expires and set default to 0
ExpiresActive On
ExpiresDefault A0
 
# Set up caching on media files for 5 weeks
<FilesMatch "\.(flv|ico|pdf|avi|mov|ppt|doc|mp3|wmv|wav)$">
ExpiresDefault A3024000
Header append Cache-Control "public"
</FilesMatch>
 
# Set up caching on media files for 5 weeks
<FilesMatch "\.(gif|jpg|jpeg|png|swf)$">
ExpiresDefault A3024000
Header append Cache-Control "public"
</FilesMatch>
 
# Set up 1 day caching on commonly updated files
<FilesMatch "\.(xml|txt|html|js|css)$">
ExpiresDefault A86400
Header append Cache-Control "proxy-revalidate"
</FilesMatch>
 
# Force no caching for dynamic files
<FilesMatch "\.(php|cgi|pl|htm)$">
ExpiresActive Off
Header set Cache-Control "private, no-cache, no-store, proxy-revalidate, no-transform"
Header set Pragma "no-cache"
</FilesMatch>
Added this to my htaccess... Didn't see much diff but figured it might shave a few seconds off anyway. Thought it was working find but it seems that one of these parameters was making the download link for downloads on the site try to download the "index.php" file. I removed the whole thing and it went away.. haven't tested them out individually yet. Oddly I did not see this problem when I tried downloading from the site. Only other customers were having issues. Anyways... just FYI

Re: [HOW TO] Speed Up Page Content

Posted: Fri Feb 04, 2011 6:14 am
by bewitching
Using the Enable GZipping, and Caching mods mentioned I went from a score of 77 to a score of 84 on WebPagetest.org !!!
NICE !
Thank you SkyHigh !!!

Re: [HOW TO] Speed Up Page Content

Posted: Wed Feb 16, 2011 9:35 pm
by deludeddonny
OK I got the image subdomain thing to work, and it made a HUGE difference,

I am now trying to add the gzip & cache thing...

This is my .htaccess

Code: Select all

# 1.To use URL Alias you need to be running apache with mod_rewrite enabled. 

# 2. In your opencart directory rename htaccess.txt to .htaccess

# For any support issues please visit: http://www.opencart.com

Options +FollowSymlinks

# Prevent Directoy listing 
Options -Indexes

# Prevent Direct Access to files
<FilesMatch "\.(tpl|ini)">
 Order deny,allow
 Deny from all
</FilesMatch>

# SEO URL Settings
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]

### Additional Settings that may need to be enabled for some servers 
### Uncomment the commands by removing the # sign in front of it.
### If you get an "Internal Server Error 500" after enabling, then restore the # as this means your host doesn't allow that.

<IfModule mod_deflate.c>
<FilesMatch "\.(js|css)$">
SetOutputFilter DEFLATE
</FilesMatch>
</IfModule>

# Turn on Expires and set default to 0
ExpiresActive On
ExpiresDefault A0

# Set up caching on media files for 5 weeks
<FilesMatch "\.(flv|ico|pdf|avi|mov|ppt|doc|mp3|wmv|wav)$">
ExpiresDefault A3024000
Header append Cache-Control "public"
</FilesMatch>

# Set up caching on media files for 5 weeks
<FilesMatch "\.(gif|jpg|jpeg|png|swf)$">
ExpiresDefault A3024000
Header append Cache-Control "public"
</FilesMatch>

# Set up 1 day caching on commonly updated files
<FilesMatch "\.(xml|txt|html|js|css)$">
ExpiresDefault A86400
Header append Cache-Control "proxy-revalidate"
</FilesMatch>

# Force no caching for dynamic files
<FilesMatch "\.(php|cgi|pl|htm)$">
ExpiresActive Off
Header set Cache-Control "private, no-cache, no-store, proxy-revalidate, no-transform"
Header set Pragma "no-cache"
</FilesMatch>
but I get 500 error... any ideas?

According to my info.php I should have gzip & deflate support...

Re: [HOW TO] Speed Up Page Content

Posted: Wed Feb 16, 2011 9:40 pm
by deludeddonny
banane wrote:why not to add

Code: Select all

<?php flush(); ?>
between </head> and <body>?
it speeds up the rendering because sends asap the first part of the page
more info here: http://developer.yahoo.com/performance/rules.html#flush
Which file should this be added to?

Re: [HOW TO] Speed Up Page Content

Posted: Thu Mar 03, 2011 4:57 pm
by glolar
I would like to post my results before and after trying some of the suggested optimizations:

With no optimization, Score: 75/100

First View: 5.391s
Repeat View: 3.211s

With GZipping enabled, Score: 78/100

First View: 5.232s
Repeat View: 3.548s

After caching added, Score: 82/100

First View: 5.230s
Repeat View: 1.643s

I tried creating a subdomain for my images, but when I did, none of my images would display. Can someone tell me what I am doing wrong?

My new subdomain is:

images123.glolar.com (with root directory of home/public_html/images123)

Here is my config.php with new lines added (old lines are commented out):

// DIR
// define('DIR_IMAGE', '/home/glolar/public_html/store/image/');
define('DIR_CONFIG', '/home/glolar/public_html/store/system/config/');

Here is my admin/config.php with new lines added (old lines are commented out):
// HTTP
// define('HTTP_IMAGE', 'http://glolar.com/store/image/');
define('HTTP_IMAGE', 'http://images123.glolar.com/');

// DIR
// define('DIR_IMAGE', '/home/glolar/public_html/store/image/');
define('DIR_IMAGE', '/home/glolar/public_html/images123/');

I copied my images from the old /store/image/data folder to the new /data folder, and my cache/data folder was created by OpenCart, and my cached images are in there, but I am getting no images when I view my OpenCart pages. Can someone tell me what I am missing here?

Thanks in advance.

Re: [HOW TO] Speed Up Page Content

Posted: Fri Mar 11, 2011 8:18 pm
by speedingorange
Can someone explain why you cant just use the image directory already within opencart as a subdomain?

surely that way you could access it as

Code: Select all

http://www.mystore.com/image
and
http://image.mystore.com/
Or am I completely wrong? (more than likely that I am wrong. Could someone explain why :) )

Re: [HOW TO] Speed Up Page Content

Posted: Tue Mar 15, 2011 9:35 am
by glolar
I am posting again here, without the stats, so hopefully someone can tell me what I am doing wrong with the image subdomain:

I tried creating a subdomain for my images, but when I did, none of my images would display. Can someone tell me what I am doing wrong?

My new subdomain is:

images123.glolar.com (with root directory of home/public_html/images123)

Here is my config.php with new lines added (old lines are commented out):

// DIR
// define('DIR_IMAGE', '/home/glolar/public_html/store/image/');
define('DIR_CONFIG', '/home/glolar/public_html/store/system/config/');

Here is my admin/config.php with new lines added (old lines are commented out):
// HTTP
// define('HTTP_IMAGE', 'http://glolar.com/store/image/');
define('HTTP_IMAGE', 'http://images123.glolar.com/');

// DIR
// define('DIR_IMAGE', '/home/glolar/public_html/store/image/');
define('DIR_IMAGE', '/home/glolar/public_html/images123/');

I copied my images from the old /store/image/data folder to the new /data folder, and my cache/data folder was created by OpenCart, and my cached images are in there, but I am getting no images when I view my OpenCart pages. Can someone tell me what I am missing here?

Thanks in advance.