Forum Moderators: phranque

Message Too Old, No Replies

404 Question

         

notbob

3:53 am on Sep 30, 2003 (gmt 0)

10+ Year Member



Let's say I have two urls that don't exist on my website (www.url.com/test1.shtml and www.url.com/test2.shtml)

Is there a way to have some code that if someone goes to a page that is a 404, it runs an SSI.

As an example, if someone went to the webpage www.url.com/test1.shtml, the 404 would load the following:

#include virtual=" page.cgi?test1.shtml

On the other hand, if someone went to the webpage www.url.com/test2.shtml, the 404 would load the following:

#include virtual=" page.cgi?test2.shtml

In needs to be generic enough that if someone types in something completely random such as www.url.com/dsfhjsdf.shtml, the 404 would load the following #include virtual=" page.cgi?dsfhjsdf.shtml

Thanks

jdMorgan

4:36 am on Sep 30, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



notbob,

Perhaps you could replace the requested page name in your SSI examples above with ${REQUEST_URI} to get the file/page requested by the visitor.

<!--#include virtual="page.cgi?${REQUEST_URI}" -->

I haven't tried it. It might be missing quotes or other syntax-required characters. It might not work at all. But I did something like what you're describing several years ago, and it wasn't too terribly involved.

Jim

notbob

5:15 am on Sep 30, 2003 (gmt 0)

10+ Year Member



Would this be the correct line to add to htaccess?

ErrorDocument 404 <!--#include virtual="page.cgi?${REQUEST_URI}" -->

Thanks

Jason

[edited by: DaveAtIFG at 6:09 am (utc) on Sep. 30, 2003]
[edit reason] Removed some redundant content [/edit]