I have 3 domain names for one site. e.g example1.com, example2.com, example3.com. I want to redirect example2.com and example3.com to example1.com. I know this has to do with redirecting, but where do I put the redirect rules? in apache, or .htaccess. Any pointers? Currently I have this set up as 3 different virtual hosts pointing to the same folder. Thank you.
|
|
You can do this with either .htaccess or by add Rewrite rules in the VirtualHost config directly. The apache docs here would tell you not to use .htaccess if you can edit the server config. If you do this in .htaccess when you don't need to, apache has to first check if this file exists for every page hit. For the redirect itself, you could use something like |
|||||||||||
|
|
You can do this with DNS. In your external DNS records point example2.com and example3.com to the external IP of example1.com. |
|||||||
|