views:

1630

answers:

3

hi there

I just made a website and after running it, i think is running slow. I've put YSlow firebug plugin, and I get a C mark for my website speed(very bad, because there are some images texts and some css)

first i have to "add an expire header". How can I do that, if my hosting servers are on godaddy deluxe linux account?

many thx

+3  A: 

Would you please elaborate on what type of website you have, what languages, features etc you use.

Usually sending headers is language specific. for PHP you you use the headers() function (http://www.php.net/manual/de/function.header.php)

You would add a header like this:

<?php
header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past
?>

dont forget: the header always has to be the first output sent to the browser, so it's wise to have it as the first line in a script, or if not possible, as the first line that outputs something.

additionally, you can upload a very small page without images, and dynamic code, check how fast it loads. Then add a dynamic page that doesnt do much, check how fast it loads. next take a dynamic page with a DB access, check how long it loads.

Like this you can limit the problem to certain fields (dynamic scripts slow is a hint for high cpu usage on your server, slow DB queries: DB server is really busy etc)

If none of this helps, the problem is with your application. Measure the total download size per pageload, and you can see if youre transferring huge amounts of data.

greetings, tom

Tom
To get caching to work (for images, css, and javascript) you actually want to set an expires date in the **future**! The sample above with a 1997 date will force every hit to reload all the content which is why @dole doug was getting a low performance score with YSlow.
scunliffe
A: 

You don't mention what webserver you are using and whether you have static or dynamic content, but assuming you are using Apache as a webserver, take a look at this: mod_expire

Ricardo Reyes
+2  A: 

GoDaddy support says:

Thank you for bringing this to our attention. Unfortunately, mod_expires is not supported in our shared hosting environment. We appreciate your patience and understanding in this matter.

How do you set expires headers without .htaccess?

Becca