Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

share|improve this question
    
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 Answer 1

up vote 1 down vote accepted

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
share|improve this answer
    
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

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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