On Mon, Apr 15, 2013 at 06:57:13PM -0400, Chris Arnold wrote:
> We have a server at http://rootsite.net. We also have another site/app that 
> runs at http://apps.rootsite.net. We host client applications on our server 
> using apache so the above site/app needs to be 
> http://apps.ourclientsdomain.tld. Here is what i have gotten to work in the 
> site/app virtual host file:
> 
> ServerName apps.*
> 
>     RewriteEngine On
>     RewriteCond %{HTTP_HOST} ^apps\.
>     RedirectMatch ^/$ /somealias/
> 
> This appears to work, however, it has also taken over our root site. So 
> http://rootsite.net now takes you to http://rootsite/somealias. How can i 
> stop this from happening? I assume i have something amiss in the above 
> rewrite?

Here is a possible solution without mod_rewrite:

<VirtualHost 1.2.3.4:80>
        ServerName rootsite.net
        ... config specific to this site here ...
</VirtualHost>

<VirtualHost 1.2.3.4:80>
        ServerName apps.rootsite.net
        ServerAlias apps.*
        ... config specific to this other site here ...
        UseCanonicalName Off
        RedirectMatch   ^/$     /somealias/
</VirtualHost>

In this way the Redirect only applies to the virtual hosts which are
specified and leaves all others untouched. The added bonus is that you
can avoid loading the heavy mod_rewrite at all.

HTH,

Pete
-- 
Openstrike - improving business through open source
http://www.openstrike.co.uk/ or call 01722 770036 / 07092 020107

Attachment: pgpBe7Xq9Hflx.pgp
Description: PGP signature

Reply via email to