Custom Error Messages
New to MT 3.12x is the tag <MTHTTPErrorCode>. This tag is only applicable to dynamic pages but we can use this tag and a bit of PHP to serve different error messages for different error codes -- currently no matter what the error message 403, 500 etc, mtview.php just says "The requested page could not be found."
For example, replace the contents of the Dynamic Pages Error Template with this
<?php
$err = $this->tag('MTHTTPErrorCode');
if ($err == 404) { ?>
This is a 404 Error
<?php } else { ?>
<$MTErrorMessage$>
<?php } ?>
If the error code is 404 (Page Not Found) the error message displayed will be "This is a 404 Error" otherwise for all other error codes it will just display the value of <$MTErrorMessage$> You can add to this by having different error codes for example, add the following just before else
elseif ($err == 403){ ?>
Forbidden, you aren't allowed!
<?php } ?>
Now when an error message is encountered and the error code is 403 (Forbidden) the message "Forbidden, you aren't allowed!" will be displayed. And you can go on and on and add numerous error code but always make sure that
<?php else { ?>
<$MTErrorMessage$>
<?php } ?>
exists. Obviously, you can make any customizations you want that can range from a simple text message to complicated forms.

Neil T. said:
on Oct 21, 2004 10:06 PM | Reply
Thanks, I just modified my Dynamic Error Template so that it differentiates from when a page isn't found to when there's actually an error with the template. That was really helpful.
Relaxedguy said:
on May 5, 2005 4:17 AM | Reply
Thanks for the tip. Save us newbies some frustration and past the code as it should be pasted in because when you insert the 403 error code you must remove the closed PHP tags after it otherwise you get errors.
This is a 404 Error
Forbidden, you aren't allowed!
Relaxedguy said:
on May 5, 2005 4:18 AM | Reply
Thanks for the tip. Save us newbies some frustration and past the code as it should be pasted in because when you insert the 403 error code you must remove the closed PHP tags after it otherwise you get errors.
oregano said:
on Jun 2, 2005 2:48 AM | Reply
I just got started with Movable Type last weekend after making the move from Blogger. I'm using PHP and dynamic pages but, I am unable to get the error page to do its thing. Any ideas?
Joshua Kaufman said:
on Dec 5, 2006 12:47 AM | Reply
Sorry, I wasn't able to get this working either. I've customized my error template as you instructed but it doesn't load for anything other than a 404.
I'm actually quite disappointed that MT doesn't do this by itself...
Joanna said:
on Apr 25, 2007 5:30 PM | Reply
This doesn't seem to be working for my site any longer since the addition of MTTags.
Instead of my customized error page I get the following:
error in template: found but MTTags was expected
Any ideas on how to fix this?
Joanna said:
on Apr 25, 2007 9:21 PM | Reply
Disregard the above. I got this to work again. Thanks!