[mdlug] Apache rewrite not working

mat.enders at gmail.com mat.enders at gmail.com
Fri Apr 29 08:49:40 EDT 2011


Sorry but let's get the obvious out af the way first. Have you restarted Apache since adding the rule. 
Sent on the Sprint® Now Network from my BlackBerry®

-----Original Message-----
From: "Michael ORourke" <mrorourke at earthlink.net>
Sender: mdlug-bounces at mdlug.org
Date: Fri, 29 Apr 2011 08:45:09 
To: MDLUG's main mailing list<mdlug at mdlug.org>
Reply-To: MDLUG's Main discussion list <mdlug at mdlug.org>
Subject: [mdlug] Apache rewrite not working

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






_______________________________________________
mdlug mailing list
mdlug at mdlug.org
http://mdlug.org/mailman/listinfo/mdlug


More information about the mdlug mailing list