Loading


Advertisement:

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

Omarcito

  • Full Member
  • ***
  • Posts: 138
Re: Increase your website speed on Apache : .htaccess tweak you could do
« Reply #30 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

MissTS

  • Newbie
  • *
  • Posts: 32
Re: Increase your website speed on Apache : .htaccess tweak you could do
« Reply #31 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

Emmanuel

  • Hero Member
  • *****
  • Posts: 641
  • .: ♥ Quality Swiss Details ♥ :. .: Swiss Made :.
Re: Increase your website speed on Apache : .htaccess tweak you could do
« Reply #32 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:
  • 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

SmaRTeY

  • Osclass Hero
  • Hero Member
  • *
  • Posts: 2232
Re: Increase your website speed on Apache : .htaccess tweak you could do
« Reply #33 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

Emmanuel

  • Hero Member
  • *****
  • Posts: 641
  • .: ♥ Quality Swiss Details ♥ :. .: Swiss Made :.
Re: Increase your website speed on Apache : .htaccess tweak you could do
« Reply #34 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 Osclass , 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

ezybusy

  • Full Member
  • ***
  • Posts: 135
Re: Increase your website speed on Apache : .htaccess tweak you could do
« Reply #35 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?

SteveJohnson

  • Sr. Member
  • ****
  • Posts: 288
  • Golden tip - Clear your cache :|
Re: Increase your website speed on Apache : .htaccess tweak you could do
« Reply #36 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.