Advertisement:

Author Topic: Increase your website speed on Apache : .htaccess tweak you could do  (Read 52823 times)

Emmanuel

  • Hero Member
  • *****
  • Posts: 645
  • .: ♥ Quality Swiss Details ♥ :. .: Swiss Made :.
Here is a little tweak you could add to your .htaccess to increase the website speed - (you can locate the .htaccess text file @ the root folder of your installation. If you cant view it - use your legacy file manager, e.g. cPanel ).

ADD the following code to your installed .htaccess
*** do NOT replace the current .htaccess file ***, ADD the following code at the beginning of it :
Code: [Select]
## EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/gif A2592000
ExpiresByType image/jpeg A2592000
ExpiresByType image/jpg A2592000
ExpiresByType image/png A2592000
ExpiresByType image/x-icon A2592000
ExpiresByType text/css A86400
ExpiresByType text/javascript A86400
ExpiresByType application/x-shockwave-flash A2592000
#
<FilesMatch "\.(gif¦jpe?g¦png¦ico¦css¦js¦swf)$">
Header set Cache-Control "public"
</FilesMatch>
</IfModule>
## EXPIRES CACHING ##

This leverages the cache and increases your site speed.


You can also enable gzip 'ed served content by adding up the following snippet:

Code: [Select]
#Gzip
<ifmodule mod_deflate.c>
AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript text/javascript
</ifmodule>
#End Gzip

These instructions tell your server to compresse the specified files, decreasing the size of the transferred chunks, hence improving the loading speed but may also increases the server load. Anyway, always test with the great YSlow extension to determine the gain according to your server config, additional improvements, aso..


P.S.  Tweak the .htaccess only if you know what you are doing. Messing up with .htaccess may crash your site.
*** BACKUP YOUR ORIGINAL .htaccess file BEFORE UPLOADING THIS TWEAKED VERSION ***

P.P.S. : Another additional important "speed increasing tip" is given here:
http://doc.osclass.org/Combine_.js_and_.css_files_to_make_OSClass_load_faster
« Last Edit: August 22, 2012, 02:52:36 pm by emanwebdev »

RoyalC

  • Full Member
  • ***
  • Posts: 128
Re: Increase your website speed on Apache : .htaccess tweak you could do
« Reply #1 on: July 28, 2012, 05:46:35 pm »
great
thanks.

cutabovehost

  • Newbie
  • *
  • Posts: 26
Re: Increase your website speed on Apache : .htaccess tweak you could do
« Reply #2 on: August 21, 2012, 04:41:39 pm »
Great advice thanks for sharing.

Emmanuel

  • Hero Member
  • *****
  • Posts: 645
  • .: ♥ Quality Swiss Details ♥ :. .: Swiss Made :.
Re: Increase your website speed on Apache : .htaccess tweak you could do
« Reply #3 on: August 22, 2012, 02:54:41 pm »
One another easy transparent solution that does NOT require any change to the code is to use the Varnish cache.

Varnish Cache is a web application accelerator also known as a caching HTTP reverse proxy. You install it in front of any HTTP server.
Transparent to the PHP application! Cache requests and serve results, bypassing the underlying app. Clever!

If you have SSH access to your server, you can install it:
https://www.varnish-cache.org/

web2graphics

  • Jr. Member
  • **
  • Posts: 74
Re: Increase your website speed on Apache : .htaccess tweak you could do
« Reply #4 on: August 23, 2012, 07:49:11 pm »
One another easy transparent solution that does NOT require any change to the code is to use the Varnish cache.

Varnish Cache is a web application accelerator also known as a caching HTTP reverse proxy. You install it in front of any HTTP server.
Transparent to the PHP application! Cache requests and serve results, bypassing the underlying app. Clever!

If you have SSH access to your server, you can install it:
https://www.varnish-cache.org/
Thanks a lot for the tips. Have you implemented those in your osclass website?if yes can we take a look?  -thanks

web2graphics

  • Jr. Member
  • **
  • Posts: 74
Re: Increase your website speed on Apache : .htaccess tweak you could do
« Reply #5 on: September 13, 2012, 09:49:30 am »
Hi OSC folks in there!


I can smell moneyyyy

cutabovehost

  • Newbie
  • *
  • Posts: 26
Re: Increase your website speed on Apache : .htaccess tweak you could do
« Reply #6 on: September 13, 2012, 10:39:59 am »
I can tell you for sure that even though many say CloudFlare is the greatest.
I had several catastrophic failures using it. One I tried it and found my site being redirected to
some site asking users to enter information for a loan.
I forget what happened the next time I tried it. Either way it was killing my uptime completely.

Emmanuel

  • Hero Member
  • *****
  • Posts: 645
  • .: ♥ Quality Swiss Details ♥ :. .: Swiss Made :.
Re: Increase your website speed on Apache : .htaccess tweak you could do
« Reply #7 on: September 13, 2012, 03:06:20 pm »
I can smell moneyyyy


right, you can save quite a bunch of $$$ per month just for the BandWidth

Emmanuel

  • Hero Member
  • *****
  • Posts: 645
  • .: ♥ Quality Swiss Details ♥ :. .: Swiss Made :.
Re: Increase your website speed on Apache : .htaccess tweak you could do
« Reply #8 on: September 13, 2012, 03:08:52 pm »
About the CloudFlare  "solution" :

I had several catastrophic failures using it. One I tried it and found my site being redirected to
some site asking users to enter information for a loan.
I forget what happened the next time I tried it. Either way it was killing my uptime completely.

WOW!  that's terrible!
Thanks 4 your precious advice. I'm brand new to CloudFlare, just using for a couple of days

Oh, let's forget CloudFlare then
UPDATE: Post relative to CloudFlare deleted


Yesterday, I found we can use the front-end servers of Google to create a free Content Data Network

I'm exploring this solution now and will post back here later
https://developers.google.com/appengine/
« Last Edit: September 13, 2012, 06:26:10 pm by emanwebdev »

thefreebro

  • Newbie
  • *
  • Posts: 16
Re: Increase your website speed on Apache : .htaccess tweak you could do
« Reply #9 on: September 18, 2012, 06:09:29 am »
I actually use cloudflare on multiple websites and I notice only positive effect.

"The sites are loading faster".

I never had down times, so I cannot say how it works exactly when one site is down, but I saw it all-ready in action on other famous websites when they were over - visited, the site stayed up, but only few functionalities were not working.

It's really weird actually cloudflare redirecting to some loan page ???

Emmanuel

  • Hero Member
  • *****
  • Posts: 645
  • .: ♥ Quality Swiss Details ♥ :. .: Swiss Made :.
Re: Increase your website speed on Apache : .htaccess tweak you could do
« Reply #10 on: October 16, 2012, 02:24:33 pm »
Another GREAT option is the


https://developers.google.com/speed/pagespeed/mod

http://www.modpagespeed.com/


Awesome!!!!!!!!!!


P.S.
Installing mod_pagespeed will add the Google repository so your system will automatically keep mod_pagespeed up to date.
But if you don't want/like Google's repository on your dedicated server, just do a
sudo touch /etc/default/mod-pagespeed before installing the package.

Legion

  • Hero Member
  • *****
  • Posts: 622
  • I am founder of top20remedies.com buyeradvise.com
Re: Increase your website speed on Apache : .htaccess tweak you could do
« Reply #11 on: December 13, 2012, 02:49:15 pm »
@emanwebdev, cutabovehost,
my site it opens too slow any solution i am using cloudflare still opens slow

www.offersvalley.com

rajaseeni

  • Newbie
  • *
  • Posts: 5
Re: Increase your website speed on Apache : .htaccess tweak you could do
« Reply #12 on: December 14, 2012, 03:43:40 pm »
Thanks guys.

tomshaft

  • Guest
Re: Increase your website speed on Apache : .htaccess tweak you could do
« Reply #13 on: December 29, 2012, 01:29:24 am »
Have to reply to say thanks. The Htaccess works great. Pages open in a blink.

Tom

Aficionado

  • Guest
Re: Increase your website speed on Apache : .htaccess tweak you could do
« Reply #14 on: April 05, 2013, 10:53:12 pm »
Are there any side effects for visitors, using this .htaccess tweak ?

Thanks