httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Leif W" <warp-...@usa.net>
Subject Re: [users@httpd] Redirection
Date Thu, 02 Oct 2003 22:15:33 GMT
I'm not at all sure why you'd want to do it this way... funky is indeed
apropos.  ;-)

If I understand correctly, every time a page is found missing, you're
checking if there's a cache page in existence that says it doesn't exist, if
not, you're creating a new page on the disk that says it doesn't exist, then
doing a redirection to that newly created page?  Why use the .htaccess
files?  This I'm not too clean on.  I'm also not too familiar with (or fond
of?) the technique of using readable files underneath a cgi-bin, usually you
don't want them readable, they're going to be executable, and the server
will treat them as programs.

If I were approaching the problem of an 404 error handler, I'd probably
create a template page, read it into my perl script, swap patterns (anchors
in the template) with replacement data (URL that was missing), and output to
browser.  With caching, you've got to have some sort of cron job to run a
script to handle cache cleaning periodically.  Sometimes a simpler solution
leads to less headaches in troubleshooting.

Leif

----- Original Message ----- 
From: "Joris Vankerschaver" <Joris.Vankerschaver@UGent.be>
To: <users@httpd.apache.org>
Sent: Thursday, October 02, 2003 3:14 AM
Subject: [users@httpd] Redirection


> Hi,
>
> I'm experiencing strange behaviour with my CGI setup under Apache 2.0.47.
> The problem is the following:  I want to set up some sort of Funky
> Caching, where a 404 error is generated as soon as a page is not found.
> Through a custom .htaccess file, a CGI script is then called to regenerate
> this page and redirect the browser to this new page.
>
> It is precisely in this last step that I have a problem.  To redirect, my
> script outputs the following:
>
> ---
> Location: http://127.0.0.1/~joris/cgi-bin/cache/page.html
> Content-Type: text/html
>
> <html>
> [snip]
> </html>
> ---
>
> Whenever I call the CGI script directly (i.e. by entering the URL in my
> browser), redirection works OK.  But - and this is the funny thing -
> whenever it's called through my .htaccess file, the redirection fails:
> the HTTP headers seem to be ignored and all I see is the HTML ([snip] in
> the excerpt).  My .htaccess contains the following line:
>
> ErrorDocument 404 /~joris/cgi-bin/refresh.cgi
>
> Can someone help me with this?  I don't need a full solution (though this
> would be nice), a pointer to a reference about the things Apache does when
> it encounters a 404 would be nice too...
>
> I really tried about everything to cure this problem: I checked the usual
> sources for help (web, archives, Apache docs), tried different solutions
> and looked at other people's sourcecode (most people don't use
> redirection, instead they open the html file they've just regenerated and
> output that.  I didn't find that a very elegant solution - though it might
> be the only thing that works...), so that's why I post this message here:
> I'm really, really stuck...
>
>
> Thank you for your consideration,
>
> Joris
>
> ---------- Joris.Vankerschaver@ugent.be --------------



---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message