On Apr 19, 2013, at 4:48 AM, "Pete Houston" <p...@openstrike.co.uk> wrote:

> 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.

That does help... I just wanted a way to rewrite http://apps.* to 
http://apps*/alias. Http://apps. will never change so I was trying to have 
apache catch the apps. part and rewrite it.

Reply via email to