Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
error_default returns blank page
Hi guys,
I’ve done a search of the forums (and Google, naturally), however, I can’t seem to get my 404 page working. I have replaced the content of the error_default page with:
<txp:php>
header(‘HTTP/1.0 404 Not Found’);
header('Location: http://snkhan.co.uk/oops/error404.php');
</txp:php>
However, all this does is show a blank page. TP is sending the user to this error_default page because if I type anything else after the header above then this too is displayed.
My TP install is off-the-root, i.e., http://snkhan.co.uk/journal
I’m at a loss to understand what I might be doing wrong, and would be grateful for any help or suggestions.
Saj
Offline
#2 2011-04-22 22:33:10
- els
- Moderator

- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: error_default returns blank page
Something like this maybe?
header("HTTP/1.0 404 Not Found");
include("/path/to/root/oops/error404.php");
Offline
Offline
Re: error_default returns blank page
Thanks, the include is working, however one of the includes called at the bottom of the page is returning a fatal error – possibly because we have included the error file rather than redirected to it. Anyway of getting the header: location to work in this instance?
http://snkhan.co.uk/journal/ThisPageDoesNotExist
Offline
Re: error_default returns blank page
snkhan wrote:
Anyway of getting the header: location to work in this instance?
Isn’t redirecting really bad practice? “Oops, seems that I accidentally typed car, instead of cat, I just change that one letter and…”
Thanks, the include is working, however one of the includes called at the bottom of the page is returning a fatal error – possibly because we have included the error file rather than redirected to it.
What is the contents of the error404.php? What is the error? If you just want to display the contents (or output) of error404.php, you can use file_get_contents() instead of include which would evaluate PHP code.
Offline
#6 2011-04-23 11:46:45
- els
- Moderator

- From: The Netherlands
- Registered: 2004-06-06
- Posts: 7,458
Re: error_default returns blank page
Is there a reason you can’t just create a page template ‘error_404’ and copy the content of your error404.php into it?
Offline
Pages: 1