0

very simply I have a website with multiple domains. One of the domains I'm wanting to forward with htaccess so if traffic ever came to that domain it would forward an to another url.

I could redelegate but based on our current setup we need to keep the delegation the same.

How do we do this with .htaccess - or is there a better way?

  • What web server are you using? – DrStalker Sep 4 '09 at 3:44
  • He tagged apache, so I assume it is apache. – David Rickman Sep 4 '09 at 3:54
  • apache on a webfaction box – willdanceforfun Sep 4 '09 at 3:56
1

your .htaccess:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^domain\.com
RewriteRule ^(.*)$ http://www.domain.com/$1 [R=permanent,L] 

mod_alias can do this as well in a little easier fashion.

RedirectPermanent / http://www.domain.com
  • wouldn't this redirect all traffic to another domain? i'm wanting this site to still accept traffic, just not from 1 domain in particular. – willdanceforfun Sep 4 '09 at 4:13
  • The server would still accept traffic from domain1 but it would automatically forward the end user to domain2. The example above is if you wish to redirect all requests of domain1 to www.domain1.com. In the mod_alias example, it is configured in the vhost file for the domain and uses 301 redirects to inform the browser that domain1 goes to domain2 instead. – David Rickman Sep 4 '09 at 6:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.