+91-943-185-6038 me@shashidharkumar.com

htaccessHow to redirect web based page with .htaccess
Following are the code to paste (be careful to write on .htaccess it can be messed up whole website if anything goes wrong) into .htaccess file 301 redirection for any domain :

RewriteEngine On
RewriteCond %{HTTP_HOST} !^www.olddomain.com
RewriteRule ^(.*)$ http://www.newdomain.com [R=301,L]
newdomainRewriteRule ^$ http://www.newdomain.com [R=301,L]
RewriteRule ^index.htm$ http://www.newdomain.com [R=301,L]
RewriteRule ^index.php$ http://www.newdomain.com [R=301,L]
RewriteRule ^index.html$ http://www.newdomain.com [R=301,L]
RewriteRule ^index.shtml$ http://www.newdomain.com [R=301,L]
RewriteRule ^index.asp$ http://www.newdomain.com [R=301,L]
RewriteRule ^default.asp$ http://www.newdomain.com [R=301,L]
RewriteRule ^index.aspx$ http://www.newdomain.com [R=301,L]
RewriteRule ^index.cfm$ http://www.newdomain.com [R=301,L]
RewriteRule ^index.pl$ http://www.newdomain.com [R=301,L]
RewriteRule ^default.htm$ http://www.newdomain.com [R=301,L]

See also  PHP Tutorial - Part V