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

How to compress JavaScript and css with gzip in typo3 || How to minify JavaScript and css in typo3 || How to speed up typo3 || scriptmerger extension


 
One of the easiest ways to improve the performance of a website is to compress the JavaScript and CSS files.

For compress your css and js file with gzip. you have to use scriptmerger extension for minify your js and css file.

For that you have to first install “scriptmerger” extensions from extension manager.

then after you have to include “scriptmerger” in your static template file [Template -> (Edit the whole template record) -> Include Static]

Following script should do the trick and paste below script in your .htaccess file.

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

If you want to compress your css file then you have to set below typoscript in your set file [template]

plugin.tx_scriptmerger {
  css.enable = 1
  css.minify.enable = 1
  css.compress.enable = 1
}

Note : css.enable = 0
It means it will not compress

Compress your JS file then you have to set below typoscript in your set file [template]

plugin.tx_scriptmerger {
  javascript.enable = 1
  javascript.minify.enable = 1
  javascript.compress.enable = 1
}

Note :
1 is stand for enable to compress your file.
0 is stand for disable to compress your file.

By default all setting are enable. you can modify your setting as per your requirement.

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

I hope it will work for you 🙂

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

How to redirect old url to new url using htaccess, php and meta


 


 
If you move your site without loosing your search engine ranking and incoming links then following script will be helping you

Your OLD URL is : http://www.hariomrubber.com/request-a-quote.html
and you want to redirect it on new url like
New Rewrite URL: http://www.hariomrubber.com/contact-us.html

then you have to use below script in your .htaccess file
Below script is a rewrite URL htaccess

RewriteCond %{REQUEST_URI} ^/request-a-quote.html$
RewriteRule .* /contact-us.html [L,R=301]

if you open old url then it will be redirect to new url.

Or, if you simply want to redirect all URLs from the old domain to a specific page on the new domain
then add this to the root .htaccess file on the old domain:

RedirectMatch 301 / http://www.hariomrubber.com/about-us.html

Redirect from one file type to another

If you want to change the extension of your web pages, Like .php to .html and file names remaining the same then add below script to your .htaccess:

RedirectMatch 301 /(.*)\.php http://hariomrubber.com/$1.html

Removing file extension via .htaccess

If you have the following URLs for your website:
http://www.hariomrubber.com/about-us.html

However, you would like to hide file extensions from the end users, and allow them to access to the files using the following URLs:
http://www.hariomrubber.com/about-us

then you have to use following in your .htaccess file

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.html -f
RewriteRule ^(.*)$ $1.html
# Replace html with your file extension, eg: html, php, asp

Alternate redirect methods via meta tag

Redirect via tag in the document. below meta tag add after your head tag in your html

<head><meta http-equiv="refresh" content="3; url=http://hariomrubber.com/">

Alternate redirect methods via PHP

To redirect via PHP, add following code in your file:

     header ('HTTP/1.1 301 Moved Permanently');
     header( "http://hariomrubber.com/" );

Will be add more blog about htaccess file.

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

How to change browser caching on your site


 
How to set leverage browser caching cpanel

In your .htaccess file you can paste the following directives at the top of the file:

## CACHING - EXPIRES - BEGIN##

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"

## CACHING - EXPIRES - END##

By using this code, our main static files like images, CSS, JS, PDF’s etc. will be cached in order to produce faster loading times in the future.

You can see in the above code that there are time periods like “1 year” or “1 month”. These are associated with file types, as an example the above code states that a css file should be cached for a month. If you want to change that and say you want them only cached for a year you would simply replace “1 month” with “1 year”. The values above are pretty optimized for most webpages and blogs.

<FilesMatch "\.(ico|pdf|jpg|jpeg|png|gif|html|htm|xml|txt|xsl)$">
Header set Cache-Control "max-age=29030400"
</FilesMatch>

you have set all files (PDF, image, webpage, etc) to expire in peoples’ browsers after 1 year.

It is easy to leverage browser caching in TYPO3 and other CMS with this tutorial.

That’s it for leveraging browser caching with your .htaccess file!

I hope it will help you lot.. Best Luck 🙂

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

301 permanent redirection of website


 
If you want to redirect your http://YOUR-DOMAIN.in/ URL into browser than you have to add below script code in your htaccess file.

it will be redirected to http://www.YOUR-DOMAIN.in/

#RewriteCond %{HTTP_HOST} !^www\.
#RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/ [R=301,L]

If anyone tried to open http://YOUR-DOMAIN.in/ URL into browser than it will be redirected to http://www.YOUR-DOMAIN.in/
If anybody want to add wwww in your URL then you have to add below code in your htaccess file.

How to Sovled the 500 – internal server error


 
mod_rewrite Problem 1&1

If you have a webhosting package at 1&1.de you may face some problems while using mod_rewrite for a website located in a subdirectory.

For example, if you create a subdirectory

/mywebsite/

and place your website (e.g., typo3 or something else) and a .htaccess file inside this. And if you try to use mod_write to have search engine friendly URLs or just rewrite urls for any other purpose, you may end up with a 500 internal server error.

To fix this problem, you should open your .htaccess file and check your RewriteBase configuration.

If your website is located in a subdirectory of your webspace, you need to set the RewriteBase configuration to:

RewriteBase /

For Example, if you want to configure the .htaccess file shipped with Typo3, and your installation is in a sub-directory “/mywebsite/”, you should modify the file as shown below:

### Begin: Settings for mod_rewrite ###
# You need rewriting, if you use a URL-Rewriting extension (RealURL, CoolUri, SimulateStatic).

# Enable URL rewriting

RewriteEngine On

# Change this path, if your TYPO3 installation is located in a subdirectory of the website root.
RewriteBase / # <= The important part of the configuration

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