Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Redirect folder from one domain to subdomain on another domain

Status
Not open for further replies.

wickyd

Technical User
Feb 14, 2002
57
ZA
Hi folks.

I have server1 running the domain: somedomain.com

I have server2 running the software that I need users to register and log into.

I want the user to type:

login.somedomain.com

and by doing so it will serve the file

one-of-my-ips/dir/file.php

I do not want the user to know that they are being redirected. It must appear as if the login system is on the same server as the domain. The address bar must not change from login.somedomain.com

How do I do this?

Thank you.

Kind regards,
wickyd
 
Rob, thank you for the very fast response.

I am new to apache, so unfortunately I don't understand your response at all :)

If possible, please relate your answer to my pseudo domain names above.

Naturally, the names are not correct, but they are in the exact form that I need to translate, ie:

user types: login.somedomain.com
web server gives: one-of-my-ips/dir/file.php
address bar remains as: login.somedomain.com

Thank you.

wickyd
 
This is with the assumption of the following:
End User URL maps to Internal URL
Add one of the following to your server1 running login.somedomain.com

ProxyRequests On
ProxyPass / ProxyPassReverse /
OR
RewriteEngine on
RewriteRule ^/(.*) [P]



Rob Jordan
 
Unfortunately, this doesn't work.

Let me try and explain again ...

Server 1:
Domain: somedomain.com
IP: some.public.ip.1
Service: apache running the company website

Server 2:
Domain: Doesn't have a domain
IP: some.public.ip.2
Service: login system

Both IPs are in the same range.

End User URL maps to Internal URL This is not correct.

I want to create login.somedomain.com. Right now, it does not exist.
I want pages to be served from Server 2 when they type in the address login.somedomain.com

What I think I need to do is:
1. Create subdomain on Server1 for login.somedomain.com
2. Edit httpd.conf on Server 1 and create a virtual host for login.somedomain.com, which serves pages from another machine with a different IP address.

This is where I get stuck.

Thanks again for the help.
 
# directives outside of virtual hosts are global
# if the domain name you use for requests does not match a virtual host, it will default to the first one listed
# enables virtual hosts
NameVirtualHost *

# directives inside the virtual host only apply for requests to that virtual host
<VirtualHost>
#site/applicaiton hosted here
ServerName one-of-my-ips
DocumentRoot "/your/path/to/your/doc/root/here"
</VirtualHost>

<VirtualHost>
ServerName login.somedomain.com
# proxy requests to the other domain
ProxyRequests On
ProxyPass / ProxyPassReverse / </VirtualHost>

I would recommend looking at the apache docs on virtual hosts here:


Rob

Rob Jordan
 
Syntax error on line 528 of /usr/local/apache2/conf/httpd.conf:
Invalid command 'ProxyRequests', perhaps misspelled or defined by a module not included in the server configuration
httpd not running, trying to start

I am running Slackware 10.2.0

 
You'll need the module mod_proxy installed and loaded to use ProxyRequests. In My my case, this module exists in the modules subfolder. I'm running on RedHat 4 Linux.

Example:
LoadModule proxy_module modules/mod_proxy.so

Rob

Rob Jordan
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top