Re: [Hampshire] apache redirection problem

Top Page

Reply to this message
Author: Tom Gamble
Date:  
To: hampshire
Subject: Re: [Hampshire] apache redirection problem

On Fri, 2009-08-14 at 04:31 -0700, Peter Alefounder wrote:
> If I use a web browser to look at a local html or pdf file, is it
> possible to set things up so that a link to an external web site is
> redirected to the local file system?
>
> I have tried a .htaccess file along these lines:
>
> RewriteEngine on
> Redirect http://external.site.com/filename.html file:///home/pra/abc/filename.html
>
> and also
>
> RewriteEngine on
> RedirectMatch http://external\.site\.com file:///home/pra/abc
>
> but in all cases I just get the error message
> "external.site.com" could not be found.
>
> I have tried putting the .htaccess file in /home/pra/abc and in
> /home/pra/public_html which is the usual place apache would look
> for local files. I am not sure where it should go in this case.
>
> I am using apache 1.3.34-4.1 on Debian 4.0. This is an isolated
> system with no Internet connection.



I think you are confusing apache and your browser.

When you give your browser a URL (or is it a URI) the file: http:
https: ftp: part tells the browser which protocol to use. When you
have file:///home/pra/abc/filename.html then that will work even if
apache is not installed on the system. Your browser is just reading
local files.

If the URL is http://some.site.com/whatever.html the browser will
resolve the the IP address of some.site.com then attempt to connect to
port 80 at that address. You have no DNS since your not connected to
the Internet therefore you will get the error message
"external.site.com" could not be found. Your browser is not going to
attempt to talk to your local apache web server unless you can fool it
in to thinking external.site.com is really localhost.

Regards,
Tom.