I have about 18 domains that need to be redirected to a new one. It has to work both with or without www prepended.
I've tried this:
<IfModule mod_rewrite.c>
RewriteEngine on
Rewritecond %{HTTP_HOST} !^www\.domain\.com
RewriteRule ^(.*)$ http://www.domain.com/$1 [R=301,L]
</IfModule>
That gives me a redirect loop (and only works with www before, i think?).
I can tell you now, having one “website” answer to multiple domains simply creates multiple websites of duplicate content and that is absolutely not beneficial for SEO and/or Google.
Pointing two URLs to the same website is a good way to direct traffic to your site from several different domain names. You can accomplish this in two ways: either redirect one of the URLs to your primary domain, or create an alias for one of the URLs. The alias would point that domain towards your primary domain.
With most registrars, it's easy to forward multiple domains to your website so you can simply create one site and then redirect visitors who type one of your other domain names to that one website.
It is possible to have multiple domains point to the same site or a directory on your site. To do this, simply assign both Addon Domains to the same directory (folder). Pro Tip: Secure more than one variation of your domain to protect your brand. Register a new domain now.
RewriteEngine on
RewriteCond %{HTTP_HOST} ^domain1.com [OR]
RewriteCond %{HTTP_HOST} ^domain2.com [OR]
RewriteCond %{HTTP_HOST} ^domain3.com [OR]
RewriteCond %{HTTP_HOST} ^domain4.com [OR]
RewriteCond %{HTTP_HOST} ^domain5.com
RewriteRule ^(.*)$ http://www.newdomain.com/$1 [R=permanent,L]
This will redirect all your 18 domains to your new single domain www.newdomain.com
.
Otherwise you can use following code to redirect each domain if they are on separate hosting:
RewriteCond %{HTTP_HOST} ^domain.com
RewriteRule ^(.*)$ http://www.newdomain.com/$1 [R=permanent,L]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With