How to redirect website to another url via .htaccess

Redirect individual website address to another one
To redirect individual files, like to about-me.html you can use a 301 redirect like this:

Redirect 301 /about.html /about-me.html

To redirect one specific file to another domain such as to

Redirect 301 /oldurl.htm

Redirect an old domain to a new domain
If you had an old domain name such as, and now you decided you actually want to use new domain for the website. You could setup a 301 redirect for the entire domain, so that old links to carry over.
Code in the domain’s .htaccess file:

RewriteEngine on
 RewriteCond %{HTTP_HOST} ^ [NC,OR]
 RewriteCond %{HTTP_HOST} ^ [NC]
 RewriteRule ^(.*)$$1 [L,R=301,NC]

Force to use www. in domain
A search engine like Google,yahoo,bing would see and as essentially two separate websites. They recommend you pick one version
Code in the domain’s .htaccess file:

RewriteEngine on
 RewriteCond %{HTTP_HOST} ^ [NC]
 RewriteRule ^(.*)$$1 [L,R=301,NC]

Enable htaccess in xampp

Enable htaccess ( mod_rewrite ) in xampp

For some reason my install of XAMPP didn’t have mod_rewrite automatically enabled? Not really sure why but basically below are the instructions on how to enable .htaccess mod_rewrite in xampp.
1. Go to the directory of installation C:\xampp\apache\conf
2. Open and edit httpd.conf in a text editor
3. Find the line which contains

#LoadModule rewrite_module modules/

and (uncomment) change to

LoadModule rewrite_module modules/

4. Find all occurrences of

AllowOverride None

and change to

AllowOverride All

I think it appears two or three times in the httpd.conf configuration file.
5. Restart xampp