Page 1 of 1

How to reduce file size.

Posted: Mon Apr 11, 2005 5:20 am
by someberry
I was wondering around the internet (As you do) when I came across http://ag2.avidgamers.com, which has exceptionally small page sizes. I even copied the code (View-source) and uploaded it to my server, and the diference was 3-4 times the size.

I was wondering how they were able to get their file sizes so small, and if I could do the same.

Thanks,
someberry.

Posted: Mon Apr 11, 2005 5:31 am
by Bennettman
They basically use a lot of CSS in external pages to make the layout work, so that the HTML in the page doesn't have to (and they can concentrate on the content). External CSS only has to be loaded once, and it obviously results in smaller main pages.

Code: Select all

<style type=&quote;text/css&quote;>
<!--
@import 'layout.css';     /* two import statements to work */
@im\port &quote;layout.css&quote;;    /* around problems with IE on mac */
-->
</style>
Nothing to do with PHP, but meh.

Posted: Mon Apr 11, 2005 5:33 am
by someberry
So how come when I upload only the HTML, it is still 3-4 times the size, even though it is exactly the same?

Posted: Mon Apr 11, 2005 5:35 am
by Bennettman
Ah, I see what you're getting at.

I'd assume that they have page compression (such as mod_gzip) enabled on the server. As I understand it, the pages are the regular size on the server, but they're compressed by Apache before being sent out to the browser.

I don't have a clue about how to go about enabling it though.

Posted: Mon Apr 11, 2005 5:00 pm
by Ambush Commander