Forum Moderators: phranque

Message Too Old, No Replies

native apache 404 with other file recommendations?

I stumbled on this page and it gave me 'other file' recommendations

         

pixeltierra

7:14 pm on Aug 28, 2006 (gmt 0)

10+ Year Member



I stumbled on this page:

[vtcc.vt.edu...]

It looks like a native apache thing that recommends similar files. Is this true? I'd love to use this on my site(s) but within the site framework. I've been thinking of wrting a script like this for sometime, but don't have the time.

Anyone know if this is native apache stuff and/or where I could get a good php script that would do this for me?

RyanM

2:37 am on Aug 29, 2006 (gmt 0)

10+ Year Member



You have your ErrorDocument 404 parsing to a dynamic page (ie PHP).

From within PHP you get the RequestedURI and process the error from there.

Thats what I am doing or trying to do, however I am hosting static webpages with Apache and using mod_proxy to serve dynamic content (including a dynamic 404 page) from JSP. Unfortunately the content of RequestedURI is lost in translation from Apache to Tomcat.

jdMorgan

3:54 am on Aug 29, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I'm not a jsp user, but perhaps using mod_rewrite's ability to check for file exists and RewriteRule's [P] flag (proxy throughput), you could pass any needed parameters to the back-end as a query string:

Simplified example:


# Pass missing file requests to jsp back-end with requested URL-path in query string
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule (.*) http://back-end_domain_or_IP_address/404_error.jsp?REQ_URI=$1 [P]

Jim