Link to home
Start Free TrialLog in
Avatar of Marisa
MarisaFlag for United States of America

asked on

Enable Keep-Alive and Specify a cache validator

I have been pulling my hair out all day long with a page speed issue.

There are not any good sites that give you the appropriate code to inset in the .htaccess file. I need to Enable Keep-Alive and Specify a cache validator. Please help me!

Additional Info: I contacted my web host and they said that keep-alive is on, but enabling compression with gzip i not supported.

User generated image
My .htaccess file currently looks like this:

RewriteEngine On
RewriteCond %{HTTP_HOST} !^customwovenlabels.com$ [NC]
RewriteRule ^(.*)$ http://customwovenlabels.com/$1 [L,R=301]


# BEGIN WordPress
<ifmodule mod_rewrite.c>
RewriteEngine On
RewriteBase /subdirectory/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /subdirectory/index.php [L]
</ifmodule>
# END WordPress


redirect 301 /guide-woven-labels.html http://customwovenlabels.com/guide/woven-labels-guide.html
redirect 301 /wovenSpecial.html http://customwovenlabels.com/specials.html
redirect 301 /printedSpecial.html http://customwovenlabels.com/specials.html
redirect 301 /hangSpecial.html http://customwovenlabels.com/specials.html


#####################################################
# CONFIGURE media caching
#
Header unset ETag
FileETag None
<FilesMatch "(?i)^.*\.(ico|flv|jpg|jpeg|png|gif|js|css)$">
Header unset Last-Modified
Header set Expires "Fri, 21 Dec 2012 00:00:00 GMT"
Header set Cache-Control "public, no-transform"
</FilesMatch>
#
#####################################################

Open in new window

Avatar of arober11
arober11
Flag of United Kingdom of Great Britain and Northern Ireland image

Hi

Afraid Apache only allows you to alter the keep-alive values in the httpd.conf, see the context entry.


But you may alter the cache values in your .htaccess e.g.

# Cache / Performache tweaks
  ExpiresActive On
  ExpiresDefault "access plus 300 seconds"
  ExpiresByType text/css "access plus 1 week"
  ExpiresByType text/javascript "access plus 1 week"
  ExpiresByType image/* "access plus 1 month"
  ExpiresByType application/x-shockwave-flash "access plus 1 week"


<Directory />
    FileETag MTime Size

Open in new window

Avatar of Marisa

ASKER

Hmm...the "Specify a cache validator" thing didn't go away after I added that code to the .htaccess. The score is still 58. Also, with the full code I got a 500 Internal Server Error. Once I took away this code <Directory />    FileETag MTime Size  I didn't get the error, but again, it didn't do anything to help.
Avatar of Marisa

ASKER

Actually, scratch that. It did go away; it just didn't raise the score for some reason.
ASKER CERTIFIED SOLUTION
Avatar of arober11
arober11
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Marisa

ASKER

Thanks for all your help! I did everything you said (I think) and it's still telling me to enable keep-alive. If you have the Firebug plugin, you can always test it and see if you get the same result. Here is the website.

Below is what my htaccess looks like now

RewriteEngine On
RewriteCond %{HTTP_HOST} !^customwovenlabels.com$ [NC]
RewriteRule ^(.*)$ http://customwovenlabels.com/$1 [L,R=301]


# BEGIN WordPress
<ifmodule mod_rewrite.c>
RewriteEngine On
RewriteBase /subdirectory/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /subdirectory/index.php [L]
</ifmodule>
# END WordPress


redirect 301 /guide-woven-labels.html http://customwovenlabels.com/guide/woven-labels-guide.html
redirect 301 /wovenSpecial.html http://customwovenlabels.com/specials.html
redirect 301 /printedSpecial.html http://customwovenlabels.com/specials.html
redirect 301 /hangSpecial.html http://customwovenlabels.com/specials.html





# Cache / Performache tweaks
  ExpiresActive On
  ExpiresDefault "access plus 300 seconds"
  ExpiresByType text/css "access plus 1 week"
  ExpiresByType text/javascript "access plus 1 week"
  ExpiresByType image/* "access plus 1 month"
  ExpiresByType application/x-shockwave-flash "access plus 1 week"


<Directory />
    FileETag MTime Size

<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/plain text/xml  text/css application/x-javascript application/javascript
</IfModule>

Open in new window

SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Marisa

ASKER

Thanks for the previous code. This is what my web host said:

We have enabled mod_deflate through customer php.ini. Unfortunately it doesnt compress html files for SSL websites in our platform.

Keep Alive is enabled by default on our apache servers.



Could it be that the Page Speed thing just sucks?