WebsiteBaker Community Forum

General Community => Global WebsiteBaker 2.8.x discussion => Topic started by: Argos on January 20, 2010, 06:34:20 PM

Title: Suggestion: built-in "page not found" function
Post by: Argos on January 20, 2010, 06:34:20 PM
I just visited http://www.wolfcms.org/ and I noticed they have some kind of built-in Page Not Found function. Sounds cool. Instead of doing technical stuff in htaccess, just create a PNF-page from the backend, and switch it on. Just like the Intro Page function, I imagine. Would that be difficult to add to the core? Or maybe as a module?
Title: Re: Suggestion: built-in "page not found" function
Post by: Waldschwein on January 20, 2010, 07:24:00 PM
Hello Jurgen,

you mean http://help.WebsiteBaker.org/pages/en/knowledge-base/custom-error-pages.php , just without the .htaccess? Hmm, would be nice...

Yours Michael
Title: Re: Suggestion: built-in "page not found" function
Post by: Argos on January 20, 2010, 07:27:00 PM
Yep! And if possible not only for 404, but maybe for other type of error pages as well  :-D
Title: Re: Suggestion: built-in "page not found" function
Post by: Waldschwein on January 20, 2010, 07:32:23 PM
Ok, but we need for that a new way of integration into the backend then. Perhaps it's a thing to realize like the multilanguage-function in WB 2.8.1: Nobody sees it, you just have to install a module, then the options are "popping out" in page settings. Perhaps for that an Admin Tool would be nice - even more settings in the (quite long) settings list could be a bit too much. But I doubt you can create a module there without changing core files...

Yours Michael
Title: Re: Suggestion: built-in "page not found" function
Post by: thorn on January 20, 2010, 08:02:09 PM
Hello,

Instead of doing technical stuff in htaccess, just create a PNF-page from the backend, and switch it on. Just like the Intro Page function, I imagine. Would that be difficult to add to the core? Or maybe as a module?

as far as i know, there is no way to achieve this behaviour without a .htaccess-file in website baker.
That's because, in WolfCMS they use a global redirect (with a .htaccess-file, too) to redirect all pages to there internal representation (e.g.: http://cms.en/page1.html to http://cms.en/index.php?PAGE=page1.html). This way, missing-page-events can be handled by the CMS itself.

As opposed to this, WebsiteBaker still uses access-files in wb/pages/..., so missing-page-events will be handled by Apache instead. And the only way to tell apache what to do in case of such a missing-page-event, a .htaccess-file is needed (as described here: http://help.WebsiteBaker.org/pages/en/knowledge-base/custom-error-pages.php ).


thorn.
Title: Re: Suggestion: built-in "page not found" function
Post by: Waldschwein on January 20, 2010, 08:08:17 PM
Hello,

then... *cough* Suggestion: get rid of /pages and the "placebo" pages.php, use instead mod-rewrite or similar *cough*

Yours Michael


Edit: But a Module could do that with mod_rewrite, am I right? So I think the 40x-error-pages are created with mod-rewrite, independent how WB itself creates pages. But it's just a thought, because modules (like Topics) can create yet pages of their own...

 
Title: Re: Suggestion: built-in "page not found" function
Post by: doc on January 20, 2010, 08:52:03 PM
Hi,

as usual there are several ways to achieve this:

a) manual approach in three steps
 - create a hidden WYSIWYG page e.g. error404 with the text you want to display
 - upload .htaccess file to document root with statement:
Code: [Select]
ErrorDocument 404 /path_to_wb/pages/error404.php - /path_to_wb via $_SERVER['DOCUMENT_ROOT']

b) create a module which creates the .htaccess file and a dummy page (option to choose error codes)

c) the installation routine creates an .htaccess files and a dummy page if user wants it

d) follow the German step by step guide (http://phpmanufaktur.de/cms/topics/droplet-error-404.php) from Ralf (Berlin)

e) use the Droplet solution (http://phpmanufaktur.de/cms/topics/abfangjaeger.php) from Ralf

f) or ...

Doc
Title: Re: Suggestion: built-in "page not found" function
Post by: WebBird on January 21, 2010, 11:08:59 AM
By the way... An error page does not have to be a static page. It can be a script, too. This script can, for example, look into a map file to redirect old-to-new after re-organizing pages. (Did this some time after transferring static HTML pages to PmWiki.) Any other weird things are possible. :-D

Try:
http://www.sf-germany.de/einheiten/explo

This will lead to an 404 Not Found error, but you won't get it. Behind is a script that takes the unknown part of the URI ("explo" in this case) and looks into a database to find if there's an item "LIKE %explo%". If it finds an unique entry, it forwards to the right URI.

This works with external destinations as well as with local ones. ("explo" is a local one)

Just to show what can be done with a 404-handler...
Title: Re: Suggestion: built-in "page not found" function
Post by: crnogorac081 on January 21, 2010, 11:40:50 AM
Hi,

it would be nice that these custom error pages appear in Pages menu tree, like Intro page, what do you think ? 
Title: Re: Suggestion: built-in "page not found" function
Post by: Argos on January 21, 2010, 01:14:10 PM
I read some cool ideas on Ralf's site, so thanks. But the real point of my suggestion was to take the manual creation and uploading of the htaccess file out, and let WB do that. Every proper webdesigner knows how to deal with htaccess stuff. But to make WB as user friendly as possible for people without those skills and knowledge, I think it would be great if there could be an admin function for this somehow.
Title: Re: Suggestion: built-in "page not found" function
Post by: Ruud on January 29, 2010, 02:01:26 PM
.htaccess will not work on every server (i.e. on IIS)
If an existing htaccess is in place, you should add the handler to whatever is in there.
In that case, the order of the rules can be important too.

So.. a bit tricky to do that. A good explanation/tutorial would be better.