Static page as 404 error document

Creating and modifying plugins.
Post Reply
WebComPas
Regular
Posts: 101
Joined: Thu Nov 22, 2007 10:14 am
Contact:

Static page as 404 error document

Post by WebComPas »

Hello!

I've created a static page to be displayed in the case of 404 errors. This should be displayed if the requested blog page doesn't exist instead of the index page. Unfortunately there is no corresponding configuration option. Also I want to use it as ErrorDocument.

I would be glad, if someone could add these features to the static page plugin.

Regards,
Pascal
Interessantes aus den Themenbereichen Computer, Internet und Programmierung unter http://www.it-blog.net
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Static page as 404 error document

Post by garvinhicking »

Hi!

If you use no URL rewriting or mod_rewrite rewriting, you could edit your .htaccess file and place it as the ErrorDocument URL there.

To make it work on a staticpage, a new page attribute "Is 404 page" would need to be created, similarly to the "Is startpage" attribute, and then the plugin would need to evaluate if $serendipity['view'] is "404" and hook into the "genpage" hook to show its output (I believe where it already does a "Is startpage" output).

If I have time I can try to implement it, if someone other wants to volunteer, that would be fine by me ;)

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
WebComPas
Regular
Posts: 101
Joined: Thu Nov 22, 2007 10:14 am
Contact:

Re: Static page as 404 error document

Post by WebComPas »

I just added this feature to the plugin. So one staticpage can be used as 404 error document if the webserver is configured accordingly.
Interessantes aus den Themenbereichen Computer, Internet und Programmierung unter http://www.it-blog.net
bernd_d
Regular
Posts: 468
Joined: Thu Jun 03, 2010 9:28 am
Contact:

Re: Static page as 404 error document

Post by bernd_d »

garvinhicking wrote:If you use no URL rewriting or mod_rewrite rewriting, you could edit your .htaccess file and place it as the ErrorDocument URL there.

To make it work on a staticpage, a new page attribute "Is 404 page" would need to be created, similarly to the "Is startpage" attribute, and then the plugin would need to evaluate if $serendipity['view'] is "404" and hook into the "genpage" hook to show its output (I believe where it already does a "Is startpage" output).

If I have time I can try to implement it, if someone other wants to volunteer, that would be fine by me ;)
Gavin, if i am not totaly wrong you already have made such a plugin for me ;)

http://board.s9y.org/viewtopic.php?f=11&t=16928
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Static page as 404 error document

Post by garvinhicking »

Hi!

But it's better to have it combined in the staticpage plugin, to be able to use that :)

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
bernd_d
Regular
Posts: 468
Joined: Thu Jun 03, 2010 9:28 am
Contact:

Re: Static page as 404 error document

Post by bernd_d »

Sure :)

With this solution, i don't need another plugin anymore ;)
Post Reply