Forum Moderators: phranque
I want to permanently redirect any traffic going to a bunch of domains I have to one single domain. Example:
Anyone going to:
domain.com
www.domain.net
domain.net
www.domain.org
domain.org
Redirect to:
www.domain.com
I read somewhere that this can be acomplished by inserting a script like this into the .htaccess file:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^domain.com
RewriteRule (.*) http://www.domain.com/$1 [R=301,L]
How can I perform multiple conditions as described above?
RewriteCond %{HTTP_HOST}!^www\.domain\.com
replacing
RewriteCond %{HTTP_HOST} ^domain.com
In the example you provided, you were looking for requests for domain.com (without the www), and then processing the rule.
In the modification I am suggesting, you are looking for requests for anything but www.domain.com (the! character means not), and then invoking the rule. This would take care of any other domains you have pointing to your webspace, along with non www. requests for your real domain. Make sure there is a space between the } and! characters when you make the change, the editing system at WebmasterWorld removes it.