Redirect website using .htaccess

Sometimes we have to redirect the website from one url to another OR from one folder inside the website to another folder of different website.
Then you have to create a .htaccess file inside that folder or website. If that already exists then just place the below code otherwise create a .htaccess file within that folder
or in root of the website.
Windows doesnot let you create .htaccess file directly. To Create a .htaccess file in windows use following way :

1. Create a new empty text file.
2. Open that file . Go to file >> Save As
3. Save the file as .htaccess .

Now place the following code in htaccess file :

RewriteEngine on
RewriteCond %{HTTP_HOST} ^http ://$
RewriteRule ^(.*)$ http ://$1 [R,L]

Now upload this file to the server .