httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Igor Cicimov <>
Subject Re: [users@httpd] Rewrite Rule Help (again)
Date Wed, 11 Jul 2012 03:53:30 GMT
On Wed, Jul 11, 2012 at 1:22 PM, Chris Arnold

> >You may need to change the R to a P:
> >RewriteEngine On
> >RewriteCond %{HTTP_HOST} !^$ [NC]
> >RewriteRule ^/$ http://private.ip.address/ [P,L]
> This sends all http traffic to the private ip server
> >This turns the rule into a proxy to that private IP, assuming that is
> >what you are trying to accomplish.
> I am not sure what the "technical" name is of what i am trying to do. The
> lines between rewrite and proxy are blurred to say the least. That is why i
> have tried to give an accurate description of what i am trying to do.
> >Finally, if you want URLS other than the root to be proxied, you may
> >need to capture the URI like so:
> >RewriteEngine On
> >RewriteCond %{HTTP_HOST} !^$ [NC]
> >RewriteRule ^/(.*)$ http://private.ip.address/$1 [P,L]
> Because the first suggestion did not work, i tried this one and it sends
> all http traffic to the iis server too.
> Just to maybe giv a better account of what i am trying to do. We have a
> webserver (say webserv A) that fulfills http port 80 requests and uses
> apache. We have another webserver that runs a program that requires it to
> run on 80 and uses iis. We have 1 public ip, with public dns entries for a
> number of hostnames and matching private dns entries. The firewall sends
> all port 80 traffic to the apache server. We need only will come
to the apache server) to be redirected/proxied to the iis
> server. We need the other websites, and the other
> sites to still be served on the apache server. Here is
> the first part of the vhost file:
> <VirtualHost *:80>
>     ServerAdmin
>     ServerName
>     ServerAlias
>     #SSLProxyEngine On
>     #ProxyPass /ifolder/
>     #ProxyPassReverse /ifolder/
>     RewriteEngine On
>     RewriteRule ^/ifolder(.*) https://%{HTTP_HOST}/ifolder/ [L]
>     RewriteRule ^/admin(.*) https://%{HTTP_HOST}/admin/ [L]
>     RewriteCond %{HTTP_HOST} !^$ [NC]
>     RewriteRule ^/(.*)$$1 [P,L]
> I hoped this clears up some stuff up and makes it clear what i need apache
> to do.
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:
Your configuration doesn't make sense. When requests for
updates.domain.netcome apache will look in the VirtualHost
configurations and try to find the
one that matches the server name ie ServerName In your
case virtual host like that doesn't exists. Putting the redirects inside
virtual host named WILL NOT work from the reason I just
explained, that virtual host will never receive those requests.

So, you have two options:

1. Create new virtual host with ServerName
2. Put the redirect lines OUTSIDE the wrong virtual host ie in the
httpd.conf file so they get caught by the server when none of the hosts
match the request HTTP_HOST

which was exactly what Eric Covener suggested on 4 of July:

Check %{HTTP_HOST} with a rewritecond or put it in a context (non
> default name-based vhost) that only matches the desired hostname.

but you didn't understand it obviously.


View raw message