Osclass forums
Support forums => Installation / Update help => Topic started 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 :
## 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:
#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
-
great
thanks.
-
Great advice thanks for sharing.
-
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/
-
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
-
Hi OSC folks in there!
I can smell moneyyyy
-
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.
-
I can smell moneyyyy
right, you can save quite a bunch of $$$ per month just for the BandWidth
-
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/)
-
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 ???
-
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.
-
@emanwebdev, cutabovehost,
my site it opens too slow any solution i am using cloudflare still opens slow
www.offersvalley.com
-
Thanks guys.
-
Have to reply to say thanks. The Htaccess works great. Pages open in a blink.
Tom
-
Are there any side effects for visitors, using this .htaccess tweak ?
Thanks
-
I've been using the htaccess tweak since late Dec. 2012 and see no problems.
Tom
-
Just added this code, thanks the website is loading faster ;)
-
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)
# 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.
# 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
-
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 :
## 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:
#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?
-
.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).
-
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 :
## 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:
#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?
-
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
-
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.
-
Yes I have you tube plugin , how do i do that
-
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
-
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 :
## 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:
#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
-
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 :
AddType video/ogg .ogv
AddType video/mp4 .mp4
AddType video/webm .webm
----etc---
Add too the expiration for ALL the filetypes your website hosts:
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: ???
<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
<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)$">
-
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.
-
Thanks I feel this improve my classified website http://adzhome.com (http://adzhome.com) performance.
-
Thanks man. This .htaccess trick works for me. :)
-
Hi:
This works on VPS and Cloud, but as I can do it on a shared hosting.
Thank you very much
-
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
-
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:
- Arrival of the management of APC cache
- ...
- Arrival of PHP 7
- ... and all I have not seen while away ;)
◄►► Question:
What is the recommended cache solution today with Osclass 3.6+ ???
Thank you in advance for your help
-
Hi Emmanuel, welcome back!
I would simply go for latest Osclass using php Opcache which is available nowadays in Osclass 8)
Regards,
Eric
-
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
-
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 :
## 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:
#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
<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
<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
####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?
-
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.
-
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 :
## 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:
#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
------------------------------------------------
<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]
-
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
------------------------------------------------
<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]
-
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
------------------------------------------------
<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]
-
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
------------------------------------------------
<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]
-
Try replacing '30' with '10'
And make sure you empty all browser cache before trying new setting
-
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.
-
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.
-
Ok. I will open new topic. Thanks :)