custom 404 message

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Locked
SiNn3D

custom 404 message

Post by SiNn3D »

hi there,

I've set a custom 404 message in the Global settings, but it won't show when I type in a wrong URL.
something like: www.cms.nl/index.php?page=i-dont-exist

I get the default server 404 message instead.

System Info:
CMS Made Simple 1.2
Windows Server 2003 (not my own choice  ;))
IIS 6.0
PHP Version 5.1.6
MySql 5.0.22
Pierre M.

Re: custom 404 message

Post by Pierre M. »

Hello,

sorry to ask this simple question, but have you checked the chekbox to activate the custom 404 message ?

Pierre M.
SiNn3D

Re: custom 404 message

Post by SiNn3D »

yes i did...
I also pressed the submit button and when i return to the global settings page my settings are still there.
I cleared the cache.
I tried it with and without templates.

everything else seems to work as it should...
Pierre M.

Re: custom 404 message

Post by Pierre M. »

Hello,

please retry with latest 1.2.3 and try with yourownscript.php?param=something

Pierre M.
SiNn3D

Re: custom 404 message

Post by SiNn3D »

I have succesfully upgraded to version 1.2.3 (thanks for reminding me ;))
However it did not have any effect on my problem.

What I noticed was that the site-down option does work, even when i give a wrong parameter.

Do you have any ideas or tips about where I should look for the problem?
I have the urge to look towards IIS settings, but it's the CMS itself that decides that the page does not exist right?
It's not like my own PHP pages automatically forward to the 404 page when i put a wrong parameter in them...
Pierre M.

Re: custom 404 message

Post by Pierre M. »

Hello,

I've suggested yourownscript.php?param=something to know how it works out of CMSms. Please try this and (un)existing static pages and report the 200s and the 404s.

Have you set up some pretty URL or any URL rewriting ?
I wish you had an IIS guru at hand...

Pierre M.
SiNn3D

Re: custom 404 message

Post by SiNn3D »

Pierre M. wrote: I've suggested yourownscript.php?param=something
Ah I misread that, but i did answer it in my previous post.
My own phpscripts do not forward to 404 when an unknown parameter is given.
I also haven't set up any URL rewriting (yet).

Though I do think I found the problem. In content.functions.php I see this:
function content_get_template($tpl_name, &$tpl_source, &$smarty_obj)
{
global $gCms;
$config =& $gCms->GetConfig();
$pageinfo = &$gCms->variables['pageinfo'];

if (isset($pageinfo) && $pageinfo->content_id == -1)
{
#We've a custom error message...  return it here
[glow=yellow,2,300]header("HTTP/1.0 404 Not Found");[/glow]
[glow=yellow,2,300]header("Status: 404 Not Found");[/glow]
if ($tpl_name == 'content_en')
$tpl_source = get_site_preference('custom404');
else
$tpl_source = '';
return true;
}
else.....
I believe that when sending those headers (while using IIS) everything else is ignored. So that would explain why I can't get the custom 404 message, but can get the site-down message.

I will investigate if any settings in IIS can prevent this and I will post my findings here in case more people have this probem or to enable you to make the custom 404 compatible with IIS.
Locked

Return to “CMSMS Core”