Re: Rewrite Rule Rewriting root site

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Apr 19, 2013, at 4:48 AM, "Pete Houston" 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:
>
>
> ServerName rootsite.net
> ... config specific to this site here ...
>

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

>
> 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.
[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux