[mdlug] Apache rewrite not working

Michael ORourke mrorourke at earthlink.net
Fri Apr 29 08:45:09 EDT 2011


Lug Nuts,

I am running into a problem with an Apache rewrite rule, here's the format 
of the vhost config file I am using:

Listen  x.x.x.x:80
<VirtualHost x.x.x.x:80>
    ServerName www.example.com
    ServerAlias www.newsite.com
    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^example\.com [OR]
    RewriteCond %(HTTP_HOST) ^www\.newsite\.com [OR]
    RewriteCond %(HTTP_HOST) ^newsite\.com
    RewriteRule ^(.*)$ http://www.example.com [R=permanent,L]

The DNS records for both the domains point to the same public address.
Site Newsite should redirect to www.example.com
The first rule for adding www. to example.com does work but neither of the 
newsite rules does.
I have the same format working for a different site and different virtual 
host, but the redirect for www.newsite.com does not work.

Any ideas?

Thanks,
Mike









More information about the mdlug mailing list