Osclass forums

Support forums => Installation / Update help => Topic started by: Emmanuel on July 28, 2012, 04:20:32 pm

Title: Increase your website speed on Apache : .htaccess tweak you could do
Post by: Emmanuel on July 28, 2012, 04:20:32 pm
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
Title: Re: Increase your website speed on Apache : .htaccess tweak you could do
Post by: RoyalC on July 28, 2012, 05:46:35 pm
great
thanks.
Title: Re: Increase your website speed on Apache : .htaccess tweak you could do
Post by: cutabovehost on August 21, 2012, 04:41:39 pm
Great advice thanks for sharing.
Title: Re: Increase your website speed on Apache : .htaccess tweak you could do
Post by: Emmanuel 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/
Title: Re: Increase your website speed on Apache : .htaccess tweak you could do
Post by: web2graphics 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
Title: Re: Increase your website speed on Apache : .htaccess tweak you could do
Post by: web2graphics on September 13, 2012, 09:49:30 am
Hi OSC folks in there!


I can smell moneyyyy
Title: Re: Increase your website speed on Apache : .htaccess tweak you could do
Post by: cutabovehost 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.
Title: Re: Increase your website speed on Apache : .htaccess tweak you could do
Post by: Emmanuel 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
Title: Re: Increase your website speed on Apache : .htaccess tweak you could do
Post by: Emmanuel 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/ (https://developers.google.com/appengine/)
Title: Re: Increase your website speed on Apache : .htaccess tweak you could do
Post by: thefreebro 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 ???
Title: Re: Increase your website speed on Apache : .htaccess tweak you could do
Post by: Emmanuel 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.
Title: Re: Increase your website speed on Apache : .htaccess tweak you could do
Post by: Legion 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
Title: Re: Increase your website speed on Apache : .htaccess tweak you could do
Post by: rajaseeni on December 14, 2012, 03:43:40 pm
Thanks guys.
Title: Re: Increase your website speed on Apache : .htaccess tweak you could do
Post by: tomshaft on December 29, 2012, 01:29:24 am
Have to reply to say thanks. The Htaccess works great. Pages open in a blink.

Tom
Title: Re: Increase your website speed on Apache : .htaccess tweak you could do
Post by: Aficionado on April 05, 2013, 10:53:12 pm
Are there any side effects for visitors, using this .htaccess tweak ?

Thanks
Title: Re: Increase your website speed on Apache : .htaccess tweak you could do
Post by: tomshaft on April 05, 2013, 11:17:28 pm
I've been using the htaccess tweak since late Dec. 2012 and see no problems.
 
 
Tom
Title: Re: Increase your website speed on Apache : .htaccess tweak you could do
Post by: darnell on May 18, 2013, 02:03:09 am
Just added this code, thanks the website is loading faster  ;)
Title: Re: Increase your website speed on Apache : .htaccess tweak you could do
Post by: Aficionado on May 18, 2013, 02:10:12 am
Some additional tweaks for .htaccess

1. use PHP 5.3 if you are using 5.2 (usually default on most hosters). For me it is a bit faster.

Code to use in .htaccess on the very top of it (check also with your hoster for the code, maybe it varies from hoster to hoster)

Code: [Select]
# Use PHP 5.3
AddType application/x-httpd-php53 .php
#

2. Use compression in apache www (if your hoster allows it)


Code to use in .htaccess on the very top of it.

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

I hope i helped
Title: Re: Increase your website speed on Apache : .htaccess tweak you could do
Post by: WebSuccess4You on June 28, 2013, 09:57:29 pm
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

Is this quote CloudFare?   You lost me.  You give all this info then you start debating CloudFare.  What is the connection,please?
Title: Re: Increase your website speed on Apache : .htaccess tweak you could do
Post by: dev101 on August 29, 2013, 07:54:51 pm
.htaccess mod has nothing to do with CloudFlare (http://blog.cloudflare.com/what-is-cloudflare) service.

Posted above is an Apache server directive that basically tells user's browser how long the cached files remains valid (in seconds if I am not mistaken).
Title: Re: Increase your website speed on Apache : .htaccess tweak you could do
Post by: shamim_biplob on October 27, 2013, 12:15:14 pm
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


i tried your both code (for cache and gzip) but nothing is working for my site. i check by google page speed.  can you help me?
Title: Re: Increase your website speed on Apache : .htaccess tweak you could do
Post by: data99 on January 16, 2014, 09:56:53 pm
I have install osclass to my subdomain and I dont see there .htaccess i see it on my main domain only

default

## 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 ##



edit to
 ## 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 ##

## 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 ##


is this correct
Title: Re: Increase your website speed on Apache : .htaccess tweak you could do
Post by: SmaRTeY on January 16, 2014, 11:10:36 pm
It looks to me that your default was already ok.
I am not sure about the subdomains and htaccess, could be that the main one is also auto handled for subdomains but you could copy the htaccess from main to the subdomain(s) root(s).

What I think could be added is the caching of FLV files which, if I am correct, are the videos from YouTube. So if you are using the YouTube plugin you might also want to cache the flv's.
Title: Re: Increase your website speed on Apache : .htaccess tweak you could do
Post by: data99 on January 16, 2014, 11:29:52 pm
Yes I have you tube plugin , how do i do that
Title: Re: Increase your website speed on Apache : .htaccess tweak you could do
Post by: SmaRTeY on January 17, 2014, 01:44:56 am
Add the expiration for the filetype:
ExpiresByType video/x-flv A2592000

You have to add the extension to the ones already there like this:

<FilesMatch "\.(gif¦jpe?g¦png¦ico¦css¦js¦swf¦FLV)$">

Here's interesting YouTube info regarding file formats to consider:
http://productforums.google.com/forum/#!topic/youtube/09SUZOge91s (http://productforums.google.com/forum/#!topic/youtube/09SUZOge91s)

You could do the same for PDF if you use the printPDF plugin as well but you have to google for the expire def. because i don't know these by head.


Regards,
Eric
Title: Re: Increase your website speed on Apache : .htaccess tweak you could do
Post by: Emanuel on March 03, 2014, 03:33:02 pm
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
Title: Increase your website speed on Apache : .htaccess tweak you could do
Post by: Emmanuel on March 05, 2014, 02:19:26 am
Right, the initial original post (http://forums.osclass.org/installation-update-help/increase-your-website-speed-on-apache-htaccess-tweak-you-could-do/msg31548/#msg31548) was an example to complete:

Right, basically, Add **ALL** the types your web server serves: (sounds...relevant  ;))

e.g. for example, add at the top of the .htaccess :
Code: [Select]
AddType video/ogg .ogv
AddType video/mp4 .mp4
AddType video/webm .webm

----etc---

Add too the expiration for ALL the filetypes your website hosts:

Code: [Select]
ExpiresByType video/x-flv A2592000
ExpiresByType video/x-ogg A2592000
ExpiresByType video/x-mp4 A2592000

----etc---

Yes, you have to add too the extension to the ones already there:
e.g. for example:
<FilesMatch "\.(ico|css|js|jpe?g|png|gif|swf|flv|mp4|webm|ogv|gz|ttf)$">

i.e. INCLUDING FONTS files if you use fancy ones (big files used on EVERY page!)

don't forget this one:  ???
Code: [Select]
<FilesMatch "\.(appcache|crx|css|eot|gif|htc|ico|jpe?g|js|m4a|m4v|manifest|mp4|oex|oga|ogg|ogv|otf|pdf|png|safariextz|svg|svgz|ttf|vcf|webapp|webm|webp|woff|xml|xpi)$">

you want more? yes? Yes!, a long long list of file extensions?
here you are then    :P
Code: [Select]
<FilesMatch "\.(css|js|htc|CSS|JS|HTC|html|htm|rtf|rtx|svg|svgz|txt|xsd|xsl|xml|HTML|HTM|RTF|RTX|SVG|SVGZ|TXT|XSD|XSL|XML|ico|asf|asx|wax|wmv|wmx|avi|bmp|class|divx|doc|docx|eot|exe|gz|gzip|jpg|jpeg|jpe|gif|mdb|mid|midi|mov|qt|mp3|m4a|mp4|m4v|mpeg|mpg|mpe|mpp|otf|odb|odc|odf|odg|odp|ods|odt|ogg|pdf|png|pot|pps|ppt|pptx|ra|ram|svg|svgz|swf|tar|tif|tiff|ttf|ttc|wav|wma|wri|xla|xls|xlsx|xlt|xlw|zip|ASF|ASX|WAX|WMV|WMX|AVI|BMP|CLASS|DIVX|DOC|DOCX|EOT|EXE|GIF|GZ|GZIP|ICO|JPG|JPEG|JPE|MDB|MID|MIDI|MOV|QT|MP3|M4A|MP4|M4V|MPEG|MPG|MPE|MPP|OTF|ODB|ODC|ODF|ODG|ODP|ODS|ODT|OGG|PDF|PNG|POT|PPS|PPT|PPTX|RA|RAM|SVG|SVGZ|SWF|TAR|TIF|TIFF|TTF|TTC|WAV|WMA|WRI|XLA|XLS|XLSX|XLT|XLW|ZIP)$">
Title: Re: Increase your website speed on Apache : .htaccess tweak you could do
Post by: Aficionado on March 26, 2014, 06:02:43 pm
A bit Of Topic but i would like point out that instead of making Apache "faster", just switch to LiteSpeed. Simple as that.

I did 3 months ago.
Title: Re: Increase your website speed on Apache : .htaccess tweak you could do
Post by: Diviyah on June 17, 2014, 07:08:44 am
Thanks I feel this improve my classified website http://adzhome.com (http://adzhome.com) performance.
Title: Re: Increase your website speed on Apache : .htaccess tweak you could do
Post by: Tomyxas on September 16, 2014, 10:36:12 am
Thanks man. This .htaccess trick works  for me. :)
Title: Re: Increase your website speed on Apache : .htaccess tweak you could do
Post by: Omarcito on September 20, 2014, 05:33:05 pm
Hi:
This works on VPS and Cloud, but as I can do it on a shared hosting.
Thank you very much
Title: Re: Increase your website speed on Apache : .htaccess tweak you could do
Post by: MissTS on October 21, 2015, 05:45:11 pm
i would create a user account on another browser and test users end.
i find that is the only real way for find out about how anything effects users on a site
Title: Re: Increase your website speed on Apache : .htaccess tweak you could do
Post by: Emmanuel on April 11, 2016, 01:56:04 pm
Hello

Back with Osclass since my last message on March...2014 !
http://forums.osclass.org/installation-update-help/increase-your-website-speed-on-apache-htaccess-tweak-you-could-do/msg88573/#msg88573

then at that time Osclass was version 3.4+


Situation since the end of 2014:


◄►► Question:

What is the recommended cache solution today with Osclass 3.6+ ???

Thank you in advance for your help
Title: Re: Increase your website speed on Apache : .htaccess tweak you could do
Post by: SmaRTeY on April 12, 2016, 08:01:39 pm
Hi Emmanuel, welcome back!

I would simply go for latest Osclass using php Opcache which is available nowadays in Osclass 8)


Regards,
Eric
Title: Re: Increase your website speed on Apache : .htaccess tweak you could do
Post by: Emmanuel on April 25, 2016, 12:04:38 pm
Hi Eric, thanks

I would simply go for latest Osclass using php Opcache which is available nowadays in Osclass 8)

As per Configure cache on Osclas (https://doc.osclass.org/Configure_cache_on_Osclass)s , they are 2 cache solutions available

Any benchmarks or tests regarding APC/PCu  vs  MEMCACHE ?

faster vs smaller memory footprint?


Thanks in advance for your links or results of tests/benchmarks

Best to all of you

Emmanuel
Title: Re: Increase your website speed on Apache : .htaccess tweak you could do
Post by: ezybusy on June 08, 2016, 04:29:16 pm
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

Hi everyone,
i found a plugin called Htaccess Editor which provides the following codes to increase the performance of a website:

To Enable Compression add these lines to your htaccess file
Code: [Select]
<IfModule mod_deflate.c>
# force deflate for mangled headers
<IfModule mod_setenvif.c>
  <IfModule mod_headers.c>
    SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)\s*,?\s*)+|[X~-]{4,13}$ HAVE_Accept-Encoding
    RequestHeader append Accept-Encoding "gzip,deflate" env=HAVE_Accept-Encoding
  </IfModule>
</IfModule>

# HTML, TXT, CSS, JavaScript, JSON, XML, HTC:
<IfModule filter_module>
  FilterDeclare   COMPRESS
  FilterProvider  COMPRESS  DEFLATE resp=Content-Type $text/html
  FilterProvider  COMPRESS  DEFLATE resp=Content-Type $text/css
  FilterProvider  COMPRESS  DEFLATE resp=Content-Type $text/plain
  FilterProvider  COMPRESS  DEFLATE resp=Content-Type $text/xml
  FilterProvider  COMPRESS  DEFLATE resp=Content-Type $text/x-component
  FilterProvider  COMPRESS  DEFLATE resp=Content-Type $application/javascript
  FilterProvider  COMPRESS  DEFLATE resp=Content-Type $application/json
  FilterProvider  COMPRESS  DEFLATE resp=Content-Type $application/xml
  FilterProvider  COMPRESS  DEFLATE resp=Content-Type $application/xhtml+xml
  FilterProvider  COMPRESS  DEFLATE resp=Content-Type $application/rss+xml
  FilterProvider  COMPRESS  DEFLATE resp=Content-Type $application/atom+xml
  FilterProvider  COMPRESS  DEFLATE resp=Content-Type $application/vnd.ms-fontobject
  FilterProvider  COMPRESS  DEFLATE resp=Content-Type $image/svg+xml
  FilterProvider  COMPRESS  DEFLATE resp=Content-Type $application/x-font-ttf
  FilterProvider  COMPRESS  DEFLATE resp=Content-Type $font/opentype
  FilterChain     COMPRESS
  FilterProtocol  COMPRESS  DEFLATE change=yes;byteranges=no
</IfModule>

<IfModule !mod_filter.c>
  # Legacy versions of Apache
  AddOutputFilterByType DEFLATE text/html text/plain text/css application/json
  AddOutputFilterByType DEFLATE application/javascript
  AddOutputFilterByType DEFLATE text/xml application/xml text/x-component
  AddOutputFilterByType DEFLATE application/xhtml+xml application/rss+xml application/atom+xml
  AddOutputFilterByType DEFLATE image/svg+xml application/vnd.ms-fontobject application/x-font-ttf font/opentype
</IfModule>
</IfModule>

To add far future expire header to your file add these lines
Code: [Select]
<IfModule mod_expires.c>
  ExpiresActive on

# Perhaps better to whitelist expires rules? Perhaps.
  ExpiresDefault                          "access plus 1 month"

# cache.appcache needs re-requests in FF 3.6 (thx Remy ~Introducing HTML5)
  ExpiresByType text/cache-manifest       "access plus 0 seconds"



# Your document html
  ExpiresByType text/html                 "access plus 0 seconds"

# Data
  ExpiresByType text/xml                  "access plus 0 seconds"
  ExpiresByType application/xml           "access plus 0 seconds"
  ExpiresByType application/json          "access plus 0 seconds"

# RSS feed
  ExpiresByType application/rss+xml       "access plus 1 hour"

# Favicon (cannot be renamed)
  ExpiresByType image/x-icon              "access plus 1 week"

# Media: images, video, audio
  ExpiresByType image/gif                 "access plus 1 month"
  ExpiresByType image/png                 "access plus 1 month"
  ExpiresByType image/jpg                 "access plus 1 month"
  ExpiresByType image/jpeg                "access plus 1 month"
  ExpiresByType video/ogg                 "access plus 1 month"
  ExpiresByType audio/ogg                 "access plus 1 month"
  ExpiresByType video/mp4                 "access plus 1 month"
  ExpiresByType video/webm                "access plus 1 month"

# HTC files  (css3pie)
  ExpiresByType text/x-component          "access plus 1 month"

# Webfonts
  ExpiresByType font/truetype             "access plus 1 month"
  ExpiresByType font/opentype             "access plus 1 month"
  ExpiresByType application/x-font-woff   "access plus 1 month"
  ExpiresByType image/svg+xml             "access plus 1 month"
  ExpiresByType application/vnd.ms-fontobject "access plus 1 month"

# CSS and JavaScript
  ExpiresByType text/css                  "access plus 1 year"
  ExpiresByType application/javascript    "access plus 1 year"
  ExpiresByType text/javascript           "access plus 1 year"

  <IfModule mod_headers.c>
    Header append Cache-Control "public"
  </IfModule>

</IfModule>

Replace default Osclass rewrite rules by these lines to improve performance
Code: [Select]
####Custom Rewrite Rules Start###
RewriteEngine on
RewriteBase /
RewriteCond $1 ^(index\.php)?$ [OR]
RewriteCond $1 \.(gif|jpg|css|js|png|ico)$ [NC,OR]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^(.*)$ - [S=1]
RewriteRule . /index.php [L]
####Custom Rewrite Rules End####

I would to know, which one between Emmanuel's code (the quoted one) and the code generated by the plugin Htaccess Editor would give better performance for my website?
Title: Re: Increase your website speed on Apache : .htaccess tweak you could do
Post by: SteveJohnson on June 14, 2016, 12:09:19 am
Any benchmarks or tests regarding APC/PCu  vs  MEMCACHE ?
Emmanuel

I use APCu with Opcache with php7 and it seems to run quite well. For Memcache (which is not in such active development as Memcached - note the D in the end), i gave up after trying a bit as the docs in osclass use the terms memcache/memcached interchangebly which is quite confusing.

I wanted to use Memcached, as it is more stable and in active development, but well i use APCu now and it works great.
Title: Re: Increase your website speed on Apache : .htaccess tweak you could do
Post by: PostFreeOnline.Com on July 28, 2017, 08:03:56 am
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 compress 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


Hi,

There are so many different codes for optimisation so can we use this code along with other leverages the cache code?  Below is the .htaccess code i am using right now please suggest me if everything is Ok. I am facing low site speed issue. there is the repete codes also so tell me which is best. I checked with Google speed test tool here

https://testmysite.thinkwithgoogle.com/intl/en-us



------------------------------------------------

Code: [Select]
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>


## 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 ##


#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


# Leverage Browser Caching
<IfModule mod_expires.c>
  ExpiresActive On
  ExpiresByType image/jpg "access 1 year"
  ExpiresByType image/jpeg "access 1 year"
  ExpiresByType image/gif "access 1 year"
  ExpiresByType image/png "access 1 year"
  ExpiresByType text/css "access 1 month"
  ExpiresByType text/html "access 1 month"
  ExpiresByType application/pdf "access 1 month"
  ExpiresByType text/x-javascript "access 1 month"
  ExpiresByType application/x-shockwave-flash "access 1 month"
  ExpiresByType image/x-icon "access 1 year"
  ExpiresDefault "access 1 month"
</IfModule>
## End Leverage Browser Caching ##


# BEGIN Expire headers
<IfModule mod_expires.c>
 ExpiresActive On
 ExpiresDefault "access plus 7200 seconds"
 ExpiresByType image/jpg "access plus 2592000 seconds"
 ExpiresByType image/jpeg "access plus 2592000 seconds"
 ExpiresByType image/png "access plus 2592000 seconds"
 ExpiresByType image/gif "access plus 2592000 seconds"
 AddType image/x-icon .ico
 ExpiresByType image/ico "access plus 2592000 seconds"
 ExpiresByType image/icon "access plus 2592000 seconds"
 ExpiresByType image/x-icon "access plus 2592000 seconds"
 ExpiresByType text/css "access plus 2592000 seconds"
 ExpiresByType text/javascript "access plus 2592000 seconds"
 ExpiresByType text/html "access plus 7200 seconds"
 ExpiresByType application/xhtml+xml "access plus 7200 seconds"
 ExpiresByType application/javascript A2592000
 ExpiresByType application/x-javascript "access plus 2592000 seconds"
 ExpiresByType application/x-shockwave-flash "access plus 2592000 seconds"
</IfModule>
# END Expire headers

# MOD_DEFLATE COMPRESSION
SetOutputFilter DEFLATE
AddOutputFilterByType DEFLATE text/html text/css text/plain text/xml application/x-javascript application/x-httpd-php
#Pour les navigateurs incompatibles
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
#ne pas mettre en cache si ces fichiers le sont déjà
SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip
#les proxies doivent donner le bon contenu
Header append Vary User-Agent env=!dont-vary

RewriteEngine on
#Check to see if browser can accept gzip files. If so and we have it - serve it!
ReWriteCond %{HTTP:accept-encoding} gzip
RewriteCond %{HTTP_USER_AGENT} !Safari
#make sure there's no trailing .gz on the url
ReWriteCond %{REQUEST_FILENAME} !^.+\.gz$
#check to see if a .gz version of the file exists.
RewriteCond %{REQUEST_FILENAME}.gz -f
#All conditions met so add .gz to URL filename (invisibly)
RewriteRule ^(.+) $1.gz [QSA,L]

<IfModule mod_gzip.c>
mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_keep_workfiles No
mod_gzip_can_negotiate Yes
mod_gzip_add_header_count Yes
mod_gzip_send_vary Yes
mod_gzip_command_version '/mod_gzip_status'
mod_gzip_min_http 1000
mod_gzip_minimum_file_size 300
mod_gzip_maximum_file_size 512000
mod_gzip_maximum_inmem_size 60000
mod_gzip_handle_methods GET POST
mod_gzip_temp_dir /tmp
mod_gzip_item_include file \.html$
mod_gzip_item_include file \.php$
mod_gzip_item_include file \.pl$
mod_gzip_item_include file \.rb$
mod_gzip_item_include file \.py$
mod_gzip_item_include file \.cgi$
mod_gzip_item_include file \.css$
mod_gzip_item_include file \.js$
mod_gzip_item_include mime ^application/javascript$
mod_gzip_item_include mime ^application/x-javascript$
mod_gzip_item_include mime ^text/.*
mod_gzip_item_include mime ^httpd/unix-directory$
mod_gzip_item_include handler ^cgi-script$
mod_gzip_item_include handler ^server-status$
mod_gzip_item_include handler ^server-info$
mod_gzip_item_include handler ^application/x-httpd-php
mod_gzip_item_exclude mime ^image/.*
</IfModule>

# BEGIN Cache-Control Headers
<IfModule mod_headers.c>
 <FilesMatch "\.(ico|jpe?g|png|gif|swf|css|gz)$">
 Header set Cache-Control "max-age=2592000, public"
 </FilesMatch>
 <FilesMatch "\.(js)$">
 Header set Cache-Control "max-age=2592000, private"
 </FilesMatch>
<filesMatch "\.(html|htm)$">
Header set Cache-Control "max-age=7200, public"
</filesMatch>
# Disable caching for scripts and other dynamic files
<FilesMatch "\.(pl|php|cgi|spl|scgi|fcgi)$">
Header unset Cache-Control
</FilesMatch>
</IfModule>
# END Cache-Control Headers

# KILL THEM ETAGS
Header unset ETag
FileETag none

# protect config.php
<files config.php>
order allow,deny
deny from all
</files>

# protect the htaccess file
<files .htaccess>
order allow,deny
deny from all
</files>

# protection de la lecture des répertoires
Options -Indexes



# SEO URL Settings
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)\?*$ index.php?_route_=$1 [L,QSA]

RewriteEngine On
RewriteCond %{SERVER_PORT} 80 
RewriteRule ^(.*)$ https://www.postfreeonline.com/$1 [R,L]
Title: Re: Increase your website speed on Apache : .htaccess tweak you could do
Post by: SmaRTeY on July 28, 2017, 03:08:05 pm
How's your config.php with regard to bcrypt value? (define('BCRYPT_COST', xx);)
The higher that number is the more speed loss you might experience with logins and possibly publishing of ads


Hi,

There are so many different codes for optimisation so can we use this code along with other leverages the cache code?  Below is the .htaccess code i am using right now please suggest me if everything is Ok. I am facing low site speed issue. there is the repete codes also so tell me which is best. I checked with Google speed test tool here

https://testmysite.thinkwithgoogle.com/intl/en-us



------------------------------------------------

Code: [Select]
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>


## 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 ##


#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


# Leverage Browser Caching
<IfModule mod_expires.c>
  ExpiresActive On
  ExpiresByType image/jpg "access 1 year"
  ExpiresByType image/jpeg "access 1 year"
  ExpiresByType image/gif "access 1 year"
  ExpiresByType image/png "access 1 year"
  ExpiresByType text/css "access 1 month"
  ExpiresByType text/html "access 1 month"
  ExpiresByType application/pdf "access 1 month"
  ExpiresByType text/x-javascript "access 1 month"
  ExpiresByType application/x-shockwave-flash "access 1 month"
  ExpiresByType image/x-icon "access 1 year"
  ExpiresDefault "access 1 month"
</IfModule>
## End Leverage Browser Caching ##


# BEGIN Expire headers
<IfModule mod_expires.c>
 ExpiresActive On
 ExpiresDefault "access plus 7200 seconds"
 ExpiresByType image/jpg "access plus 2592000 seconds"
 ExpiresByType image/jpeg "access plus 2592000 seconds"
 ExpiresByType image/png "access plus 2592000 seconds"
 ExpiresByType image/gif "access plus 2592000 seconds"
 AddType image/x-icon .ico
 ExpiresByType image/ico "access plus 2592000 seconds"
 ExpiresByType image/icon "access plus 2592000 seconds"
 ExpiresByType image/x-icon "access plus 2592000 seconds"
 ExpiresByType text/css "access plus 2592000 seconds"
 ExpiresByType text/javascript "access plus 2592000 seconds"
 ExpiresByType text/html "access plus 7200 seconds"
 ExpiresByType application/xhtml+xml "access plus 7200 seconds"
 ExpiresByType application/javascript A2592000
 ExpiresByType application/x-javascript "access plus 2592000 seconds"
 ExpiresByType application/x-shockwave-flash "access plus 2592000 seconds"
</IfModule>
# END Expire headers

# MOD_DEFLATE COMPRESSION
SetOutputFilter DEFLATE
AddOutputFilterByType DEFLATE text/html text/css text/plain text/xml application/x-javascript application/x-httpd-php
#Pour les navigateurs incompatibles
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
#ne pas mettre en cache si ces fichiers le sont déjà
SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip
#les proxies doivent donner le bon contenu
Header append Vary User-Agent env=!dont-vary

RewriteEngine on
#Check to see if browser can accept gzip files. If so and we have it - serve it!
ReWriteCond %{HTTP:accept-encoding} gzip
RewriteCond %{HTTP_USER_AGENT} !Safari
#make sure there's no trailing .gz on the url
ReWriteCond %{REQUEST_FILENAME} !^.+\.gz$
#check to see if a .gz version of the file exists.
RewriteCond %{REQUEST_FILENAME}.gz -f
#All conditions met so add .gz to URL filename (invisibly)
RewriteRule ^(.+) $1.gz [QSA,L]

<IfModule mod_gzip.c>
mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_keep_workfiles No
mod_gzip_can_negotiate Yes
mod_gzip_add_header_count Yes
mod_gzip_send_vary Yes
mod_gzip_command_version '/mod_gzip_status'
mod_gzip_min_http 1000
mod_gzip_minimum_file_size 300
mod_gzip_maximum_file_size 512000
mod_gzip_maximum_inmem_size 60000
mod_gzip_handle_methods GET POST
mod_gzip_temp_dir /tmp
mod_gzip_item_include file \.html$
mod_gzip_item_include file \.php$
mod_gzip_item_include file \.pl$
mod_gzip_item_include file \.rb$
mod_gzip_item_include file \.py$
mod_gzip_item_include file \.cgi$
mod_gzip_item_include file \.css$
mod_gzip_item_include file \.js$
mod_gzip_item_include mime ^application/javascript$
mod_gzip_item_include mime ^application/x-javascript$
mod_gzip_item_include mime ^text/.*
mod_gzip_item_include mime ^httpd/unix-directory$
mod_gzip_item_include handler ^cgi-script$
mod_gzip_item_include handler ^server-status$
mod_gzip_item_include handler ^server-info$
mod_gzip_item_include handler ^application/x-httpd-php
mod_gzip_item_exclude mime ^image/.*
</IfModule>

# BEGIN Cache-Control Headers
<IfModule mod_headers.c>
 <FilesMatch "\.(ico|jpe?g|png|gif|swf|css|gz)$">
 Header set Cache-Control "max-age=2592000, public"
 </FilesMatch>
 <FilesMatch "\.(js)$">
 Header set Cache-Control "max-age=2592000, private"
 </FilesMatch>
<filesMatch "\.(html|htm)$">
Header set Cache-Control "max-age=7200, public"
</filesMatch>
# Disable caching for scripts and other dynamic files
<FilesMatch "\.(pl|php|cgi|spl|scgi|fcgi)$">
Header unset Cache-Control
</FilesMatch>
</IfModule>
# END Cache-Control Headers

# KILL THEM ETAGS
Header unset ETag
FileETag none

# protect config.php
<files config.php>
order allow,deny
deny from all
</files>

# protect the htaccess file
<files .htaccess>
order allow,deny
deny from all
</files>

# protection de la lecture des répertoires
Options -Indexes



# SEO URL Settings
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)\?*$ index.php?_route_=$1 [L,QSA]

RewriteEngine On
RewriteCond %{SERVER_PORT} 80 
RewriteRule ^(.*)$ https://www.postfreeonline.com/$1 [R,L]
Title: Re: Increase your website speed on Apache : .htaccess tweak you could do
Post by: PostFreeOnline.Com on July 28, 2017, 08:14:02 pm
Hi,  I just checked my config.php and found that there was nothing like (define('BCRYPT_COST', xx);)
so i define as you guided and kept the number 30 lowest for fast speed. Below are the last 3 lines. Please check if everything is fine. Or suggest me if any mistake there. What would be best number for ideal and fast speed

--------------------------------------------

define('REL_WEB_URL', '/');

define('BCRYPT_COST', '30');

define('WEB_PATH', 'https://www.postfreeonline.com/');
?>

---------------------------------------------

How's your config.php with regard to bcrypt value? (define('BCRYPT_COST', xx);)
The higher that number is the more speed loss you might experience with logins and possibly publishing of ads



Hi,

There are so many different codes for optimisation so can we use this code along with other leverages the cache code?  Below is the .htaccess code i am using right now please suggest me if everything is Ok. I am facing low site speed issue. there is the repete codes also so tell me which is best. I checked with Google speed test tool here

https://testmysite.thinkwithgoogle.com/intl/en-us



------------------------------------------------

Code: [Select]
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>


## 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 ##


#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


# Leverage Browser Caching
<IfModule mod_expires.c>
  ExpiresActive On
  ExpiresByType image/jpg "access 1 year"
  ExpiresByType image/jpeg "access 1 year"
  ExpiresByType image/gif "access 1 year"
  ExpiresByType image/png "access 1 year"
  ExpiresByType text/css "access 1 month"
  ExpiresByType text/html "access 1 month"
  ExpiresByType application/pdf "access 1 month"
  ExpiresByType text/x-javascript "access 1 month"
  ExpiresByType application/x-shockwave-flash "access 1 month"
  ExpiresByType image/x-icon "access 1 year"
  ExpiresDefault "access 1 month"
</IfModule>
## End Leverage Browser Caching ##


# BEGIN Expire headers
<IfModule mod_expires.c>
 ExpiresActive On
 ExpiresDefault "access plus 7200 seconds"
 ExpiresByType image/jpg "access plus 2592000 seconds"
 ExpiresByType image/jpeg "access plus 2592000 seconds"
 ExpiresByType image/png "access plus 2592000 seconds"
 ExpiresByType image/gif "access plus 2592000 seconds"
 AddType image/x-icon .ico
 ExpiresByType image/ico "access plus 2592000 seconds"
 ExpiresByType image/icon "access plus 2592000 seconds"
 ExpiresByType image/x-icon "access plus 2592000 seconds"
 ExpiresByType text/css "access plus 2592000 seconds"
 ExpiresByType text/javascript "access plus 2592000 seconds"
 ExpiresByType text/html "access plus 7200 seconds"
 ExpiresByType application/xhtml+xml "access plus 7200 seconds"
 ExpiresByType application/javascript A2592000
 ExpiresByType application/x-javascript "access plus 2592000 seconds"
 ExpiresByType application/x-shockwave-flash "access plus 2592000 seconds"
</IfModule>
# END Expire headers

# MOD_DEFLATE COMPRESSION
SetOutputFilter DEFLATE
AddOutputFilterByType DEFLATE text/html text/css text/plain text/xml application/x-javascript application/x-httpd-php
#Pour les navigateurs incompatibles
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
#ne pas mettre en cache si ces fichiers le sont déjà
SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip
#les proxies doivent donner le bon contenu
Header append Vary User-Agent env=!dont-vary

RewriteEngine on
#Check to see if browser can accept gzip files. If so and we have it - serve it!
ReWriteCond %{HTTP:accept-encoding} gzip
RewriteCond %{HTTP_USER_AGENT} !Safari
#make sure there's no trailing .gz on the url
ReWriteCond %{REQUEST_FILENAME} !^.+\.gz$
#check to see if a .gz version of the file exists.
RewriteCond %{REQUEST_FILENAME}.gz -f
#All conditions met so add .gz to URL filename (invisibly)
RewriteRule ^(.+) $1.gz [QSA,L]

<IfModule mod_gzip.c>
mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_keep_workfiles No
mod_gzip_can_negotiate Yes
mod_gzip_add_header_count Yes
mod_gzip_send_vary Yes
mod_gzip_command_version '/mod_gzip_status'
mod_gzip_min_http 1000
mod_gzip_minimum_file_size 300
mod_gzip_maximum_file_size 512000
mod_gzip_maximum_inmem_size 60000
mod_gzip_handle_methods GET POST
mod_gzip_temp_dir /tmp
mod_gzip_item_include file \.html$
mod_gzip_item_include file \.php$
mod_gzip_item_include file \.pl$
mod_gzip_item_include file \.rb$
mod_gzip_item_include file \.py$
mod_gzip_item_include file \.cgi$
mod_gzip_item_include file \.css$
mod_gzip_item_include file \.js$
mod_gzip_item_include mime ^application/javascript$
mod_gzip_item_include mime ^application/x-javascript$
mod_gzip_item_include mime ^text/.*
mod_gzip_item_include mime ^httpd/unix-directory$
mod_gzip_item_include handler ^cgi-script$
mod_gzip_item_include handler ^server-status$
mod_gzip_item_include handler ^server-info$
mod_gzip_item_include handler ^application/x-httpd-php
mod_gzip_item_exclude mime ^image/.*
</IfModule>

# BEGIN Cache-Control Headers
<IfModule mod_headers.c>
 <FilesMatch "\.(ico|jpe?g|png|gif|swf|css|gz)$">
 Header set Cache-Control "max-age=2592000, public"
 </FilesMatch>
 <FilesMatch "\.(js)$">
 Header set Cache-Control "max-age=2592000, private"
 </FilesMatch>
<filesMatch "\.(html|htm)$">
Header set Cache-Control "max-age=7200, public"
</filesMatch>
# Disable caching for scripts and other dynamic files
<FilesMatch "\.(pl|php|cgi|spl|scgi|fcgi)$">
Header unset Cache-Control
</FilesMatch>
</IfModule>
# END Cache-Control Headers

# KILL THEM ETAGS
Header unset ETag
FileETag none

# protect config.php
<files config.php>
order allow,deny
deny from all
</files>

# protect the htaccess file
<files .htaccess>
order allow,deny
deny from all
</files>

# protection de la lecture des répertoires
Options -Indexes



# SEO URL Settings
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)\?*$ index.php?_route_=$1 [L,QSA]

RewriteEngine On
RewriteCond %{SERVER_PORT} 80 
RewriteRule ^(.*)$ https://www.postfreeonline.com/$1 [R,L]
Title: Re: Increase your website speed on Apache : .htaccess tweak you could do
Post by: PostFreeOnline.Com on July 28, 2017, 08:19:00 pm
Hi,  I just checked my config.php and found that there was nothing like (define('BCRYPT_COST', xx);)
so i define as you guided and kept the number 30 lowest for fast speed. But after that login keeps loading and loading. But do not load. Below are the last 3 lines. Please check if everything is fine. Or suggest me if any mistake there. What would be best number for ideal and fast speed. Also tell me what   define('REL_WEB_URL', '/');
 stand for and what we need to put between '/' place

--------------------------------------------

define('REL_WEB_URL', '/');

define('BCRYPT_COST', '30');

define('WEB_PATH', 'https://www.postfreeonline.com/');
?>

---------------------------------------------

How's your config.php with regard to bcrypt value? (define('BCRYPT_COST', xx);)
The higher that number is the more speed loss you might experience with logins and possibly publishing of ads



Hi,

There are so many different codes for optimisation so can we use this code along with other leverages the cache code?  Below is the .htaccess code i am using right now please suggest me if everything is Ok. I am facing low site speed issue. there is the repete codes also so tell me which is best. I checked with Google speed test tool here

https://testmysite.thinkwithgoogle.com/intl/en-us



------------------------------------------------

Code: [Select]
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>


## 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 ##


#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


# Leverage Browser Caching
<IfModule mod_expires.c>
  ExpiresActive On
  ExpiresByType image/jpg "access 1 year"
  ExpiresByType image/jpeg "access 1 year"
  ExpiresByType image/gif "access 1 year"
  ExpiresByType image/png "access 1 year"
  ExpiresByType text/css "access 1 month"
  ExpiresByType text/html "access 1 month"
  ExpiresByType application/pdf "access 1 month"
  ExpiresByType text/x-javascript "access 1 month"
  ExpiresByType application/x-shockwave-flash "access 1 month"
  ExpiresByType image/x-icon "access 1 year"
  ExpiresDefault "access 1 month"
</IfModule>
## End Leverage Browser Caching ##


# BEGIN Expire headers
<IfModule mod_expires.c>
 ExpiresActive On
 ExpiresDefault "access plus 7200 seconds"
 ExpiresByType image/jpg "access plus 2592000 seconds"
 ExpiresByType image/jpeg "access plus 2592000 seconds"
 ExpiresByType image/png "access plus 2592000 seconds"
 ExpiresByType image/gif "access plus 2592000 seconds"
 AddType image/x-icon .ico
 ExpiresByType image/ico "access plus 2592000 seconds"
 ExpiresByType image/icon "access plus 2592000 seconds"
 ExpiresByType image/x-icon "access plus 2592000 seconds"
 ExpiresByType text/css "access plus 2592000 seconds"
 ExpiresByType text/javascript "access plus 2592000 seconds"
 ExpiresByType text/html "access plus 7200 seconds"
 ExpiresByType application/xhtml+xml "access plus 7200 seconds"
 ExpiresByType application/javascript A2592000
 ExpiresByType application/x-javascript "access plus 2592000 seconds"
 ExpiresByType application/x-shockwave-flash "access plus 2592000 seconds"
</IfModule>
# END Expire headers

# MOD_DEFLATE COMPRESSION
SetOutputFilter DEFLATE
AddOutputFilterByType DEFLATE text/html text/css text/plain text/xml application/x-javascript application/x-httpd-php
#Pour les navigateurs incompatibles
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
BrowserMatch \bMSI[E] !no-gzip !gzip-only-text/html
#ne pas mettre en cache si ces fichiers le sont déjà
SetEnvIfNoCase Request_URI \.(?:gif|jpe?g|png)$ no-gzip
#les proxies doivent donner le bon contenu
Header append Vary User-Agent env=!dont-vary

RewriteEngine on
#Check to see if browser can accept gzip files. If so and we have it - serve it!
ReWriteCond %{HTTP:accept-encoding} gzip
RewriteCond %{HTTP_USER_AGENT} !Safari
#make sure there's no trailing .gz on the url
ReWriteCond %{REQUEST_FILENAME} !^.+\.gz$
#check to see if a .gz version of the file exists.
RewriteCond %{REQUEST_FILENAME}.gz -f
#All conditions met so add .gz to URL filename (invisibly)
RewriteRule ^(.+) $1.gz [QSA,L]

<IfModule mod_gzip.c>
mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_keep_workfiles No
mod_gzip_can_negotiate Yes
mod_gzip_add_header_count Yes
mod_gzip_send_vary Yes
mod_gzip_command_version '/mod_gzip_status'
mod_gzip_min_http 1000
mod_gzip_minimum_file_size 300
mod_gzip_maximum_file_size 512000
mod_gzip_maximum_inmem_size 60000
mod_gzip_handle_methods GET POST
mod_gzip_temp_dir /tmp
mod_gzip_item_include file \.html$
mod_gzip_item_include file \.php$
mod_gzip_item_include file \.pl$
mod_gzip_item_include file \.rb$
mod_gzip_item_include file \.py$
mod_gzip_item_include file \.cgi$
mod_gzip_item_include file \.css$
mod_gzip_item_include file \.js$
mod_gzip_item_include mime ^application/javascript$
mod_gzip_item_include mime ^application/x-javascript$
mod_gzip_item_include mime ^text/.*
mod_gzip_item_include mime ^httpd/unix-directory$
mod_gzip_item_include handler ^cgi-script$
mod_gzip_item_include handler ^server-status$
mod_gzip_item_include handler ^server-info$
mod_gzip_item_include handler ^application/x-httpd-php
mod_gzip_item_exclude mime ^image/.*
</IfModule>

# BEGIN Cache-Control Headers
<IfModule mod_headers.c>
 <FilesMatch "\.(ico|jpe?g|png|gif|swf|css|gz)$">
 Header set Cache-Control "max-age=2592000, public"
 </FilesMatch>
 <FilesMatch "\.(js)$">
 Header set Cache-Control "max-age=2592000, private"
 </FilesMatch>
<filesMatch "\.(html|htm)$">
Header set Cache-Control "max-age=7200, public"
</filesMatch>
# Disable caching for scripts and other dynamic files
<FilesMatch "\.(pl|php|cgi|spl|scgi|fcgi)$">
Header unset Cache-Control
</FilesMatch>
</IfModule>
# END Cache-Control Headers

# KILL THEM ETAGS
Header unset ETag
FileETag none

# protect config.php
<files config.php>
order allow,deny
deny from all
</files>

# protect the htaccess file
<files .htaccess>
order allow,deny
deny from all
</files>

# protection de la lecture des répertoires
Options -Indexes



# SEO URL Settings
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)\?*$ index.php?_route_=$1 [L,QSA]

RewriteEngine On
RewriteCond %{SERVER_PORT} 80 
RewriteRule ^(.*)$ https://www.postfreeonline.com/$1 [R,L]
Title: Re: Increase your website speed on Apache : .htaccess tweak you could do
Post by: SmaRTeY on July 28, 2017, 08:45:35 pm
Try replacing '30' with '10'

And make sure you empty all browser cache before trying new setting
Title: Re: Increase your website speed on Apache : .htaccess tweak you could do
Post by: PostFreeOnline.Com on July 28, 2017, 09:20:57 pm
I tried that but it starts login but not too fast.  also I saw debug log and found this error after that

When log in to Main site user account:
 [28-Jul-2017 22:44:13 Asia/Kolkata] PHP Notice:  Undefined index: s_picture_profile in /home/postfreeonline.com/oc-content/themes/mcfly/parts/blocks/menu/menu-user.php on line 67

After login to Admin panel I found this error log

[28-Jul-2017 22:48:23 Asia/Kolkata] PHP Notice:  Undefined index: plugins in /home/scorp4hj/public_html/postfreeonline.com/oc-admin/themes/modern/main/index.php on line 290
[28-Jul-2017 22:48:23 Asia/Kolkata] PHP Warning:  Invalid argument supplied for foreach() in /home/scorp4hj/public_html/postfreeonline.com/oc-admin/themes/modern/main/index.php on line 290

Before that theses were not their.


Title: Re: Increase your website speed on Apache : .htaccess tweak you could do
Post by: Aficionado on July 29, 2017, 10:25:09 am
I tried that but it starts login but not too fast.  also I saw debug log and found this error after that

When log in to Main site user account:
 [28-Jul-2017 22:44:13 Asia/Kolkata] PHP Notice:  Undefined index: s_picture_profile in /home/postfreeonline.com/oc-content/themes/mcfly/parts/blocks/menu/menu-user.php on line 67

After login to Admin panel I found this error log

[28-Jul-2017 22:48:23 Asia/Kolkata] PHP Notice:  Undefined index: plugins in /home/scorp4hj/public_html/postfreeonline.com/oc-admin/themes/modern/main/index.php on line 290
[28-Jul-2017 22:48:23 Asia/Kolkata] PHP Warning:  Invalid argument supplied for foreach() in /home/scorp4hj/public_html/postfreeonline.com/oc-admin/themes/modern/main/index.php on line 290

Before that theses were not their.

Please do not RUIN this topic with totally IRRELEVENT and support issues. Open a new Topic.

Title: Re: Increase your website speed on Apache : .htaccess tweak you could do
Post by: PostFreeOnline.Com on July 29, 2017, 11:49:20 am
Ok. I will open new topic. Thanks  :)