<p>For various reasons, such as cookies, SEO, and to keep things simple, I would like to make apache automatically redirect any requests for <a href="http://www.foobar.com/anything" rel="nofollow noreferrer">http://www.foobar.com/anything</a> to <a href="http://foobar.com/anything" rel="nofollow noreferrer">http://foobar.com/anything</a>. The best I could come up with is a mod_rewrite-based monstrosity, is there some easy simple way to tell it "Redirect all requests for domain ABC to XYZ"? </p>

<p>PS: I found <a href="https://stackoverflow.com/questions/50931/redirecting-non-www-url-to-www">this somewhat related question</a>, but it's for IIS and does the opposite of what I want. Also it's still complex.</p>

```
```
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.domain.com$ [NC]
RewriteRule ^(.*)$ http://domain.com/$1 [R=301,L]
```
```
That should do the trick.