I have a website that's migrated from an old domain name (e.g. olddomain.com) to a new domain name (e.g. newdomain.com).
For SEO reasons, I need to rewrite all website traffic to the primary new domain name (e.g. www.newdomain.com). Unfortunately, I don't know how to add multiple OR type rewrite conditions. It seems that with all the conditions, sample code below, I get an AND condition.
<VirtualHost *:80>
ServerAdmin webmaster@localhost
ServerName newdomain.com
ServerAlias www.newdomain.com
ServerAlias olddomain.com
ServerAlias www.olddomain.com
DocumentRoot /var/www/newdomain.com/www/
<Directory />
Options FollowSymLinks
AllowOverride All
</Directory>
ErrorLog /var/log/apache2/error.log
# Possible values include: debug, info, notice, warn, error, crit,
# alert, emerg.
LogLevel warn
RewriteEngine on
RewriteCond %{HTTP_HOST} ^olddomain.com [NC]
RewriteCond %{HTTP_HOST} ^www.olddomain.com [NC]
RewriteCond %{HTTP_HOST} ^newdomain.com [NC]
RewriteRule ^/(.*)$ http://www.newdomain.com/$1 [R=301,NC]
CustomLog /var/log/apache2/access.log combined
</VirtualHost>
Can someone give me a little assist? Any help would be greatly appreciated.