mod_rewrite in apache2

From: 'Dungeon' Dave (Newsgroup_at_tombstones.org.uk)
Date: 10/21/04


Date: Thu, 21 Oct 2004 19:34:11 +0100

Anyone here an apache wiz?

I've read through the apache docs on mod_rewrite and read Ralf
Engelschall's rewriting guide but I'm still no clearer on this one.

Here's me problem: I've got two webservers that offer two sites:
www.external.com and www.internal.com (for instance) - both are behind a
router, and the DNS records point to the same IP address. So far, so
good.

However, I can only NAT the external IP address to one of the
webservers. So I've got the router to point at the first webserver and
thought of setting up internal.com as a virtual domain on this server,
but then using mod_rewrite to forward traffic to the second server,
allowing it to tunnel through. I'm trying to use a rule that states:

www.internal.com/(.+) -> rewrite to: inside.internal.com/$1

So far, my attempts have failed. I've tried the following as a test:

--- code ---
<Directory "/home/httpd/sites/www.external.com/web/internal/">
    Order allow,deny
    Allow from all

  RewriteEngine On
  RewriteBase /external
  RewriteRule ^/external/(.+) http://www.internal.com/$1 [R,L]
</Directory>

----
But the apache logs complain that the "internal" directory doesn't
exist. If I create it, then it finds an empty directory - ie: seems to
ignore the rewrite.
Anyone got a suitable example I can play with?
-- 
"I call up my friend, the good angel
But she's out with her answerphone."


Relevant Pages

  • Re: avoid server folder reading
    ... I would like to know how to avoid (using PHP code) any user to read the ... content of my website folder? ... apache conf file. ... URL Rewriting to force all pages to go to SharkTooth.php ...
    (php.general)
  • Re: What Next?
    ... the time to learn about webservers, i.e. Apache. ... I just ftp the files to my ... host and forget about it. ...
    (comp.lang.php)
  • Re: gwt, qooxdoo - framework choice for a C++ && apache application
    ... rewriting entirely the ... "presentation" but leaving ... most of the server side c++ untouched. ... You can deploy it using FastCGI (within Apache), ...
    (comp.lang.javascript)
  • Re: filehandling and system() permissions.
    ... it would be apache on apache .. ... machine sperate from the webservers it needs to restart, ... I have a script that restartarts all three apaches .... ...
    (comp.lang.php)
  • Re: filehandling and system() permissions.
    ... it would be apache on apache .. ... machine sperate from the webservers it needs to restart, ... I have a script that restartarts all three apaches .... ...
    (comp.lang.php)