How to speed up website Performance || How to speed up typo3 Performance


 
Website speed up is one of the important aspect for Search Engine Optimization.

To improve your website speed we need to take care of following thing.

There are many way to speed up your current page. But One of the easiest ways to improve the performance of a website is to compress the JavaScript and CSS files.

and also you have to set some rule in your .htaccess file for speed up your website.

below script will help you to improve your performance in “Enable gzip compression”, “Leverage browser caching”, “Minify JavaScript”, “Minify CSS”, “Minify HTML”

Following Rule you have to defined in your “.htaccess” file

RewriteEngine On

RewriteRule ^typo3$ - [L]
RewriteRule ^typo3/.*$ - [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l

RewriteRule .* index.php
RewriteRule   ^typo3$  /typo3/index_re.php
RewriteRule   ^[^/]*\.html$  index.php
RewriteRule   ^[^/]*\.pdf$  index.php

<FilesMatch "\.js\.gzip$">
  AddType "text/javascript" .gzip
</FilesMatch>
<FilesMatch "\.css\.gzip$">
  AddType "text/css" .gzip
</FilesMatch>
AddEncoding gzip .gzip


<FilesMatch "\.js\.jzip$">
  AddType "text/javascript" .jzip
</FilesMatch>
<FilesMatch "\.css\.jzip$">
  AddType "text/css" .jzip
</FilesMatch>
AddEncoding jzip .jzip


<IfModule mod_expires.c>

    ExpiresActive On
    ExpiresByType text/html "access plus 2 days"
    ExpiresByType image/gif "access plus 60 days"
    ExpiresByType image/jpg "access plus 60 days"
    ExpiresByType image/jpeg "access plus 60 days"
    ExpiresByType image/png "access plus 60 days"
    ExpiresByType image/bmp "access plus 60 days"
    ExpiresByType text/javascript "access plus 60 days"
    ExpiresByType application/x-javascript "access plus 60 days"
    ExpiresByType text/css "access plus 60 days"
    ExpiresByType image/x-icon "access plus 360 days"
    
</IfModule>
    

# Cache Headers
<ifmodule mod_headers.c>

  # Cache specified files for 31 days
  <filesmatch "\.(ico|flv|jpg|jpeg|png|gif|css|swf)$">
  Header set Cache-Control "max-age=2678400, public"
  </filesmatch>
  
  # Cache HTML files for a couple hours
  <filesmatch "\.(html|htm)$">
  Header set Cache-Control "max-age=7200, private, must-revalidate"
  </filesmatch>
  
  # Cache PDFs for a day
  <filesmatch "\.(pdf)$">
  Header set Cache-Control "max-age=86400, public"
  </filesmatch>
  
  # Cache Javascripts for 31 days
  <filesmatch "\.(js)$">
  Header set Cache-Control "max-age=2678400, private"
  </filesmatch>
  
</ifmodule>


#Gzip

<ifmodule mod_deflate.c>
AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript text/javascript application/xml application/xhtml+xml application/rss+xml
</ifmodule>

#End Gzip


# Remove Browser Bugs
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
Header append Vary User-Agent


<ifModule mod_gzip.c>
  mod_gzip_on Yes
  mod_gzip_dechunk Yes
  mod_gzip_item_include file \.(html?|txt|css|js|php|pl)$
  mod_gzip_item_include handler ^cgi-script$
  mod_gzip_item_include mime ^text/.*
  mod_gzip_item_include mime ^application/x-javascript.*
  mod_gzip_item_exclude mime ^image/.*
  mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
</ifModule>


Note:Red color script only for TYPO3 

For compress your css and js files in TYPO3.

we have to use “scriptmerger” extension for minify your JavaScript and css file.

Following script should do the trick for your speed up of your typo3 page.

### BEGIN EXT:scriptmerger ###

# Removal of ETag (saves some bytes; the last modified header is still there)
FileETag MTime Size
<IfModule mod_headers.c>
	FileETag none
</IfModule>

# Client caching of JS/CSS files (because they are merged with an applied hash!)
# Note: Unsetting of the last modified header causes a permant 200 Ok status
<FilesMatch "\.(merge|min|gz)(\.gz)?\.(js|css)">
   <IfModule mod_expires.c>
      ExpiresActive on
      ExpiresDefault "access plus 1 year"
   </IfModule>

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

# deliver the uncompressed file if gzip encoding isn't accepted
AddEncoding x-gzip .gz
RewriteCond %{HTTP:accept-encoding} !gzip [NC]
RewriteRule ^typo3temp/scriptmerger/compressed/(.+)\.gz\.(js|css) typo3temp/scriptmerger/uncompressed/$1.$2 [L,NC]

### END EXT:scriptmerger ###

When compressing these files, you will get the fastest possible response from your website.

I hope your website will be run faster than before 🙂 🙂 Njoy 😉

If you have any queries, please do not hesitate to contact me at Jainish Senjaliya

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s