Page Not Found Modification

Permalink
I am in the process of creating a Concrete5 site with online help content intended to be viewed from within the context of a Silverlight application. This is done by pointing a Silverlight webbrowser control (which is merely a thinly disguised version of the local IE installation) to the relevant page on the C5 site.

The issue I have run into is this - I never want the user to see a "Page Not Found" HTTP 404 error. Instead I have coded the C5 page_not_found page to read "That help topic has not yet been created" with an HTML meta redirect to the main help index page.

This works fine - from browsers like Firefox, Opera etc. However, when IE sees the 404 header it simply ignores any page content that has been sent and just shows the default "Not found" message.

My question is simple - there must be some place where the 404 header is being injected. A search for 404 across all files in the C5 install turns up many 404s. I guess I could pinpoint the one I need to kill by trial and error but someone reading this posting should be able to save me a lot of time and effort - which would be much appreciated.

 
jshannon replied on at Permalink Reply
jshannon
You've gotten close. You've clearly found the page_not_found single page, but there's also a page_not_found controller which injects the 404.

You've ideally copied /concrete/single_pages/page_not_found.php into your root /single_pages directory and modified it. Now do the same for /concrete/controllers/page_not_found.php and remove the header() line in the view() function.

James
eclirec replied on at Permalink Reply
Thanks! That did the trick. I plan on getting a copy of the Concrete5 book one of these days. In the mean time could you explain the relationship between the scripts in the root folder and in the root/concrete folder? If you have a file bearing the same name in the corresponding subfolder in root folder does it act like an override for that file in the concrete folder? Which sounds like a load of gobbeldeygook so I hope I am making sense.
jshannon replied on at Permalink Best Answer Reply
jshannon
That's exactly what it's for.

Say you've overridden the single_page.php files in /concrete/.../page_not_found.php and there's a new version of concrete. Your changes will be overwritten. However, if you've copied the files to /.../page_not_found.php in your root, then concrete's file gets overwritten but your file is untouched and continues to override.

This happens for most files, but not all (core models come to mind).

James
eclirec replied on at Permalink Reply
Thank you!