Welcome to MobyThreads.com!
FAQFAQ      ProfileProfile    Private MessagesPrivate Messages   Log inLog in
All support for the MobyThreads Threaded phpBB MOD can now be found on welsolutions at this forum

Directing Hosts to Different URLs?

 
   Web Hosting and Web Master Forums (Home) -> Apache RSS
Next:  mod_auth_ldap  
Author Message
sorry5

External


Since: Dec 14, 2004
Posts: 5



(Msg. 1) Posted: Tue Dec 14, 2004 5:35 pm
Post subject: Directing Hosts to Different URLs?
Archived from groups: alt>apache>configuration (more info?)

I'm using Apache 1.3 and want to redirect some URLs to other URLs on a
different server.

So, at first I used:

Redirect permanent /www2 http://10.10.10.103
Redirect permanent /another http://10.10.10.103

That worked fine.

But then I realised that some requests are going to be coming from
public IP addresses (and not just the VPN as I first thought). Those
people need to be redirected to the public IP of the server, and the VPN
people can't see that.

So I tried:

RewriteCond %{REMOTE_ADDR} ^10.10\10.*
RewriteRule ^/www2 http://10.10.10.103 [L]

RewriteCond %{REMOTE_ADDR} !^10.10.10.*
RewriteRule ^/another http://217.205.135.185 [L]

But that doesn't work. Not only does everyone get directed to the
private IP, but I don't think the redirect rule is going to redirect
along the path, so /www2/foo/bar isn't going to go to
http://10.10.10.103/foo/bar as I want it to do.

I've tried to understand the docs on this, but I'm getting nowhere. Can
anyone give me any clues on how to do this?

Thanks,

Jonathan

 >> Stay informed about: Directing Hosts to Different URLs? 
Back to top
Login to vote
davideyeahsure

External


Since: Nov 03, 2003
Posts: 2907



(Msg. 2) Posted: Wed Dec 15, 2004 2:35 am
Post subject: Re: Directing Hosts to Different URLs? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

On 2004-12-14, Jonathan <sorry DeleteThis @this_is_fake.com> wrote:
 > But then I realised that some requests are going to be coming from
 > public IP addresses (and not just the VPN as I first thought).
<zap>
 > But that doesn't work. Not only does everyone get directed to the

I see two ways:
1) configure two VirtualHosts, each one listening on one IP, one for the
VPN and one for the public IP and use two different set of redirects.
This means that if you want to change one redirect you have to change
in two places.

2) configure your server as a Proxy, this way doesn't matter where the
connection came from, everybody see it as the source of the data.

Davide

--
He knows all about using Microsoft Word or Excell, and this makes him a
skilled computer support person. (The fact that he should be accompanied
everywhere by an escort of police motorcycles with sirens warbling
"LUSERluserLUSERluserLUSER ..." notwithstanding.) --Charlie<!-- ~MESSAGE_AFTER~ -->

 >> Stay informed about: Directing Hosts to Different URLs? 
Back to top
Login to vote
sorry5

External


Since: Dec 14, 2004
Posts: 5



(Msg. 3) Posted: Wed Dec 15, 2004 5:35 pm
Post subject: Re: Directing Hosts to Different URLs? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Davide Bianchi wrote:
 > On 2004-12-14, Jonathan <sorry.RemoveThis@this_is_fake.com> wrote:
 >
  >>But then I realised that some requests are going to be coming from
  >>public IP addresses (and not just the VPN as I first thought).
 >
 > <zap>
 >
  >>But that doesn't work. Not only does everyone get directed to the
 >
 >
 > I see two ways:
 > 1) configure two VirtualHosts, each one listening on one IP, one for the
 > VPN and one for the public IP and use two different set of redirects.
 > This means that if you want to change one redirect you have to change
 > in two places.
 >
 > 2) configure your server as a Proxy, this way doesn't matter where the
 > connection came from, everybody see it as the source of the data.
 >

Nice - thanks for that. I'll give those a try. It's probably possible
with mod_rewrite, but it'll take me a hell of a long time to work it out
I think.

Jonathan<!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: Directing Hosts to Different URLs? 
Back to top
Login to vote
leendert

External


Since: Nov 23, 2004
Posts: 20



(Msg. 4) Posted: Thu Dec 16, 2004 10:35 am
Post subject: Re: Directing Hosts to Different URLs? [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Op Tue, 14 Dec 2004 21:44:24 +0000, schreef Jonathan:
 > I'm using Apache 1.3 and want to redirect some URLs to other URLs on a
 > different server.
 > So, at first I used:
<font color=purple> > Redirect permanent /www2 <a style='text-decoration: underline;' href="http://10.10.10.103</font" target="_blank">http://10.10.10.103</font</a>>
<font color=purple> > Redirect permanent /another <a style='text-decoration: underline;' href="http://10.10.10.103</font" target="_blank">http://10.10.10.103</font</a>>
 > That worked fine.
 > But then I realised that some requests are going to be coming from
 > public IP addresses (and not just the VPN as I first thought). Those
 > people need to be redirected to the public IP of the server, and the VPN
 > people can't see that.
 > So I tried:
 >
 > RewriteCond %{REMOTE_ADDR} ^10.10\10.*
 > RewriteRule ^/www2 <a style='text-decoration: underline;' href="http://10.10.10.103" target="_blank">http://10.10.10.103</a> [L]
 >
 > RewriteCond %{REMOTE_ADDR} !^10.10.10.*
 > RewriteRule ^/another <a style='text-decoration: underline;' href="http://217.205.135.185" target="_blank">http://217.205.135.185</a> [L]
 >
 > But that doesn't work. Not only does everyone get directed to the
 > private IP, but I don't think the redirect rule is going to redirect
 > along the path, so /www2/foo/bar isn't going to go to
 > <a style='text-decoration: underline;' href="http://10.10.10.103/foo/bar" target="_blank">http://10.10.10.103/foo/bar</a> as I want it to do.
 >

Taking a look at your rewrite directives, I think you can sharpen them a
bit. If I understand it correctly, These should be:

RewriteCond &{REMOTE_ADDR} ^10\.10\.10\..*
RewriteRule ^/www2/(.*) http://10.10.10.103/$1 [L]

RewriteCond &{REMOTE_ADDR} !^10\.10\.10\..*
RewriteRule ^/another/(.*) http://217.205.135.185/$1 [L]

There are two things differently to your approach:
- in a regex, a dot (.) matches any character. If you want to match as a
dot, you have to escape it. eg \.
- you want everything that comes after /www2 to be appended to the new
address. This is done by capturing any character that comes after that
[-> /www2/(.*)], and appending it to the new constructed address with $1.

I haven't tried this, so I'm not sure it'll work, but you can give it a
go.

-leendert bottelberghs<!-- ~MESSAGE_AFTER~ -->
 >> Stay informed about: Directing Hosts to Different URLs? 
Back to top
Login to vote
Display posts from previous:   
Related Topics:
directing a webspace to another server? - Hi, i like to redirect a domain via httpd.conf to anthother server and there to a special directory. Is this possible or do i have to first got to the local dir and redirect from there i.e. with a header-redirect

ReWriting URLS - OK. This is what I have I have 2 domains www.mydomain.com and www.mydomain.net Both of them are pointing to the same base-directory using the same index file. What I want to do is make it so that every request for www.mydomain.com get rewrote as..

Is it possible to use ampersand in urls when using mod_rew.. - I'm using mod_rewrite and want to be able to use the ampersand (&) in urls. /java%26internet should become /search.php?title=java%26internet instead of /search.php?title=java&internet, which breaks up into "title=java" and a useles...

"Easy URLs" in Apache2 - I had Apache 1.3 installed on my server when running windows and urls like "http://blah.com/main/" would serve the file "http://blah.com/main.php". Since switching to SuSE and installing Apache2 this no longer works with the defaul...

rewriting urls gives wrong path - Hi there! I'm trying to gain some knowledge on rewriting urls but with poor results... I've got a webpage of this structure / css/ images/ main/ about.html photos.html links/ games.html photos.html i.php Now I'd like to make some rewriting....
   Web Hosting and Web Master Forums (Home) -> Apache All times are: Pacific Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]