Apache redirect after a rewrite

I'm trying to figure out how to properly do this. I'm hosting a domain that used to have a website also on the same server, however the website has now been moved to a different machine, but they want to keep the domain hosted on our DNS. Rather than changing the DNS record right now, I'm trying to figure out how to do a proxy redirect but I'm having some trouble.

Right now, I'm using the RewriteEngine to rewrite the URL as follows:

RewriteEngine on
RewriteCond %{HTTP_HOST}        !^www\.domain\.org [NC]
RewriteRule ^/(.*)              http://www.domain.org/$1 [L,R]

This is in case someone looks up the website simply by http://domain.org it will get rewritten to http://www.domain.com - that works fine.

Now I need to redirect it to go to an IP address with a username:

http://111.222.333.444/~user

Rather than simply redirecting it to that address, I'd like to do a proxy where the domain will still be visible in the browser's address bar, while also keeping the above rule in place.

Suggestions anyone?

Answers


Make sure mod_proxy is enabled and do:

<VirtualHost *:80>
    ServerName www.domain.com
    ProxyPass / http://111.222.333.444/~user
</VirtualHost>

Need Your Help

Delphi 2010 DataSnap Client with HTTPS

delphi iis ssl delphi-2010 datasnap

I have a DataSnap server written in Delphi XE3, deployed as an ISAPI module with SSL.

Fair critical section (Linux)

linux pthreads mutex critical-section

On a multi-threaded Linux application I use a mutex for critical sections. This works very well except for the fairness issue. It can happen that a thread leaving a critical section and re-entering...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.