Request for Question Clarification by
bookface-ga
on
20 Jan 2006 15:18 PST
This page has a fairly good description of the Reverse Proxy process
and what it is intended to do, which is not quite what you want to do
(but what you have currently in your config):
http://www.serverwatch.com/tutorials/article.php/10825_3290851_3
As you can see, the intention is for folder roots within the host to
be transferred to another web host, such as www.example.com/marketing
-> www.marketing.com -- your current config is set up to forward
http://s1.com/s2.com/ to http://s2.com.
I'm assuming http://s2.com:8080 will be available directly to the
user, based on what you wrote, and moreover that you have no problem
with the URL showing up in user's browsers as i.e.
http://s2.com:8080/directory/file.etc.html , but since I'm not sure
I'm posting this as a clarification request. The module you need to
know about is mod_rewrite, and it is handy for any number of URL
rewriting tasks.
Here is the official documentation:
http://httpd.apache.org/docs/2.0/misc/rewriteguide.html
This handy one-page document covers the most typical cases:
http://www.ilovejackdaniels.com/mod_rewrite_cheat_sheet.pdf
Finally, these are the specific lines you will need to your httpd.conf:
----------------------------------------------------------------------
# Forward s2.com to s2.com:8080
RewriteEngine on
RewriteCond %{HTTP_HOST} ^s2.com$ [NC]
RewriteRule ^(.*)$ http://s2.com:8080/$1 [R=301,L]
----------------------------------------------------------------------
The NC makes the rewrite condition case-insensitive, the =301 is
optional and makes the forwarding show up as an HTTP message 301 Moved
Permanently. Another option is to use R=302, which will be Moved
Temporarily. Your choice depends on your content. For more
information, see:
http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
http://www.seomatrix.com/301-redirects.php
http://www.404-error-page.com/301-apache-httpd.conf-redirect.shtml
Finally, this page explains how to handle what you're asking for, but
WITH VirtualHosts, should that become a possibility in the future:
http://www.experts-exchange.com/Web/Web_Servers/Apache/Q_21156806.html
I believe that VirtualHosts would be more efficient, but I could be
wrong -- I don't think there'd be too much of a difference either way.
I don't know that there's any other way besides those two to do what
you're asking, but there are a lot of extensions available for Apache.
- bookface-ga