How to redirect multiple domains to one domain?
I have about 4 domains that need to be redirected to a new one.
Share
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Aviance School is one of the largest web solutions platform in India for developers to learn and share their programming knowledge and build their careers.
You can redirect multiple domains to one domain using .htaccess file
Here 4 domains are redirect1.com,redirect2.com,redirect3.com and redirect4.com.These domains are redirected to example.com
Code Example:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^example\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.example\.com$
RewriteRule ^/?$ "http\:\/\/example\.com\/" [R=301,L]
RewriteCond %{HTTP_HOST} ^redirect1\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.redirect1\.com$
RewriteRule ^/?$ "http\:\/\/example\.com\/" [R=301,L]
RewriteCond %{HTTP_HOST} ^redirect2\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.redirect2\.com$
RewriteRule ^/?$ "http\:\/\/example\.com\/" [R=301,L]
RewriteCond %{HTTP_HOST} ^redirect3\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.redirect3\.com$
RewriteRule ^/?$ "http\:\/\/example\.com\/" [R=301,L]
RewriteCond %{HTTP_HOST} ^redirect4\.com$ [OR]
RewriteCond %{HTTP_HOST} ^www\.redirect4\.com$
RewriteRule ^/?$ "http\:\/\/example\.com\/" [R=301,L]