Drupal: .htaccess Access Deny
August 21, 2014 – 7:59 am | No Comment

In this article I will tell how to forbid access to certain resources for some clients. The instructions will include descriptions of different directives.

Read the full story »
CSS Templates

Contain reviews and news about CSS Templates.

Freebies

Contain freebies such as icons, graphics, headers and images for your websites.

Fun Stuff

Contains other fun stuff for entertainment or interesting site showcase.

How-To

Contain technical elaborations on some specific workarounds or common tweak.

Joomla Templates

Contains reviews and news about Joomla templates.

Home » How-To

How to Create Error Handler in Joomla

Submitted by on September 22, 2009 – 7:40 amOne Comment

Of cause, error handler will not save you from errors. But it can make error messages not so scare for users J

To create an error handler, you should create error.php file for template applied to your site.

If you use more than one template (default one and some additional template(s) for different site pages and/or sections), you need to create error.php for each of them. Put error.php to ../template/template_name folder, where template_name is a name of the used template.

Insert php code to error.php. For example,

<?php
defined ( ‘_JEXEC’ ) or die ( ‘Restricted index access’ );
if (($this->error->code) == ‘404’ || ($this->error->code) == ‘500’) {
header ( ‘Location: ‘ . $this->baseurl . ‘/404.html’ );
exit ();
}

will redirect user to 404.html in the case error 404 or 500 occurs.

Enjoy your errors! ;)

One Comment »

  • Jack says:

    humph! I did that, and got this error:

    Parse error: syntax error, unexpected T_STRING in /…/templates/template_name/error.php on line 2

    I tried to get a little fancy, this is the code from error.php

    error->code) == ’404′ || ($this->error->code) == ’500′) {
    header ( ‘Location: ‘ . $this->baseurl . ‘/notfound’ );
    exit ();
    }

    in the root .htaccess I have a redirect for biketexas.org/notfound to a specific article that gives an error message.

Leave a comment!

Add your comment below, or trackback from your own site. You can also subscribe to these comments via RSS.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

This is a Gravatar-enabled weblog. To get your own globally-recognized-avatar, please register at Gravatar.