redirect domain to same domain on other server

Using a single web hosting account to host multiple sites

redirect domain to same domain on other server

Postby denk » Wed Apr 02, 2008 5:17 am

Hi,

I'm a noob with mod_rewrite and struggling with the following issue.

I have a domain with a homepage in the root and some different directories hosted on server 1.

Now I want to move only the homepage to server 2.

example:
mydomain.com => server 2
www.mydomain.com => server 2
www.mydomain.com/dir1 => server 1
www.mydomain.com/dir2/dir2-1 => server 1

Can this issue be solved with mod_rewrite?

Thanks in advance.
denk
 
Posts: 4
Joined: Wed Apr 02, 2008 3:43 am

Postby richardk » Thu Apr 03, 2008 3:51 pm

You could proxy to server1 from server2 if you have mod_proxy and mod_rewrite
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteRule ^((dir1|dir2/dir-2)(/.*)?)$ http://server1/$1 [NC,P,L]

This will use both servers bandwidth/transfer. What are you trying to achieve?
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby denk » Fri Apr 04, 2008 12:24 am

Thanks for your reply.

We have a domain that’s directed to server1, with a website and some old applications hosted on it. For some reason they don’t want to change the registry by the registrar just yet.

Server1 is getting old and we have purchased a new server (server2) with a other hosting provider.

I developed a new website for the domain and want to host it on the new server (server2), but we don’t want to move the old applications just yet.

So, I think it's necessary to proxy to server2 from server1 on IP? :-?
Or maybe there is a other way to do it?

I hope I described the problem well and in proper English. :)
denk
 
Posts: 4
Joined: Wed Apr 02, 2008 3:43 am

Postby richardk » Sat Apr 05, 2008 4:14 pm

Yes, you will have to proxy from server2 to server 1.
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby denk » Sun Apr 06, 2008 11:19 pm

But I want to proxy from server1 to server2, and then only the website not the applications.

Example:
www.mydomain.com - proxy to server 2
www.mydomain.com/images - proxy to server 2
www.mydomain.com/app1 - stay on server 1
www.mydomain.com/app2 - stay on server 1

How can I do this?
denk
 
Posts: 4
Joined: Wed Apr 02, 2008 3:43 am

Postby richardk » Mon Apr 07, 2008 12:42 pm

In server1's document root
Code: Select all
Options +FollowSymLinks

RewriteEngine On

RewriteRule !^(app1|app2)(/.*)?$ http://server2%{REQUEST_URI} [NC,P,L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby denk » Thu Apr 17, 2008 6:55 am

Thanks a bunch Richard!!! :wink:
denk
 
Posts: 4
Joined: Wed Apr 02, 2008 3:43 am


Return to Domain Handling

Who is online

Users browsing this forum: No registered users and 27 guests

cron