You can set many types of 301 redirection from .htaccess file. We have mentioned about olddomain to newdomain 301 redirection in this topic.
For example, if you have a websitehttp://www.olddomain.com and wish to permanently forward users to http://www.newdomain.com when they browsehttp://www.olddomain.com on their browsers.
Add following lines on the .htaccess file :
RewriteEngine on
RewriteCond %{http_host} ^olddomain.com [NC,OR]
Rewritecond %{http_host} ^www.olddomain.com [nc]
RewriteRule ^(.*)$ http://newdomain.com/$1 [r=301,nc]
Accuwebhosting.com
For example, if you have a websitehttp://www.olddomain.com and wish to permanently forward users to http://www.newdomain.com when they browsehttp://www.olddomain.com on their browsers.
Add following lines on the .htaccess file :
RewriteEngine on
RewriteCond %{http_host} ^olddomain.com [NC,OR]
Rewritecond %{http_host} ^www.olddomain.com [nc]
RewriteRule ^(.*)$ http://newdomain.com/$1 [r=301,nc]
Accuwebhosting.com