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.

errors from page speed
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

LVL 1
MarisaWeb DesignAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

arober11Commented:
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

0
MarisaWeb DesignAuthor Commented:
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.
0
MarisaWeb DesignAuthor Commented:
Actually, scratch that. It did go away; it just didn't raise the score for some reason.
0
Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

arober11Commented:
Hi

You would need a closing </Directory> tag, to get the example code above to work, but assumed you would have a directory block already.

Worth loosing your entire "# CONFIGURE media caching" block, as it's simply setting an absolute date of Dec next year, which once reached (if not changed) will indicate to a users browser not to cache the objects, better to use the relative values in my example. Also disables Etags, these are handy little hashes sent in the returned header, with each request, so the browser can determine if it needs to download a more up to date copy.

Also worth considering, compressing your text based output, if not already compressed, check your headers in Chrome, e.g.

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

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
MarisaWeb DesignAuthor Commented:
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

0
arober11Commented:
Can't do anything about the Keep-alive, per my first post (http://httpd.apache.org/docs/2.2/mod/core.html#keepalive) this can only be enabled in the httpd.conf file, I can only suggest you contact your Hosting provider, to have them add a "KeepAlive On". You could also ask them to load mod_deflate, as you still have no compression.

Oh, your still missing the closing tag on the directory line e.g.

<Directory />
    FileETag MTime Size
</Directory>

Open in new window


Or this will suffice, if .htaccess based.
    FileETag MTime Size

Open in new window


0
MarisaWeb DesignAuthor Commented:
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?
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Apache Web Server

From novice to tech pro — start learning today.