To redirect a complete website, one needs to do the following changes to the root .htaccess file:
Options +FollowSymlinks
RewriteEngine on
rewritecond %{http_host} ^domain.com [NC]
rewriterule ^(.*)$ http://www.domain.com/$1 [r=301,NC]
However points to remember when there is some one-t-one relationship in the redirection. As in the case you might be required to have all the 3 conditions:
- redirect some high traffic pages to particular different pages on a different domain,
- redirect entire folders to some other folder,
- redirect rest of the pages to a different domain altogether.
Example:
1. Redirect a particular page:
RewriteRule ^2011/05/vtiger-pbx-integration.html http://www.amosvision.com/web-development/crm-modules-development.html [L,R=301]
2. Redirect entire folder:
RewriteRule ^2011/05/ http://www.amosvision.com/ [L,R=301]
3. Redirect rest of the pages:
RewriteRule ^/ http://www.amosvision.com/ [L,R=301]
In this case the RewriteRule sequence must be followed for all the requirements to be correctly meet.
Related Links: | |