CakePHP – Redirect 404 Not Found Errors to the Homepage


For some reason, you may want to redirect 404 not found error to the homepage in CakePHP website. In order to do this 2 files have to be edited/created.

1. Edit or create /app/Lib/Error/AppExceptionRenderer.php and insert the following codes

<?php
App::uses('EceptionRenderer', 'Error');
class AppExceptionRenderer extends ExceptionRenderer {
    public function error400($error) {
        return $this->controller->redirect('/');
    }

}

2. Edit /app/Config/Core.php find the following code

'renderer' => 'ExceptionRenderer',

and replace it with

'renderer' => 'AppExceptionRenderer',

3. Disable debugging by editing /app/Config/Core.php. To disable find the following code

Configure::write('debug', 2);

and change to

Configure::write('debug', 0);

Cpanel/WHM Backup in Amazon S3


WHM/cPanel, since version 11.42 allow user to do backup to Amazon S3. This is a great choice to do backup by utilizing reliable service like Amazon S3. Furthermore, new S3 user will get FREE 5GB backup storage for a year making this option even valuable. After FREE time is over, the cost is rather small only 3 cents per GB of storage

Below is the steps on how to backup cPanel/WHM in Amazon S3

Amazon S3 Configuration

  1. Login to your Amazon S3 account or create for a new account if you don’t have one.
  2. Browse to Dashboard → Services → S3
  3. Create a Bucket (Make sure there is no “.” dot in the Bucket name. If you have, you unable to connect to amazon servers due SSL issue and will give timeout error.
  4. Browse to Username → Security Credentials → Access Keys (Access Key ID and Secret Access Key)
  5. Click “Create New Access Key” button.
  6. Download the “Access Key” & keep it secure.

cPanel/WHM Configuration

  1. Login to cPanel/WHM
  2. Browse to Backup → Backup Configuration
  3. Edit Global Settings, Scheduling and Retention, Files, Databases & Configure Backup Directory as per your preference.
  4. In Additional Destinations, Select “Amazon S3™” & Click “Create new destination” button.
  5. Add “Destination Name” and optional “Folder” information in the space.
  6. Key-in “Bucket” name as (3) in Amazon S3 Configuration above.
  7. Key-ion “Access Key ID” & “Secret Access Key” as per (6) in Amazon S3 Configuration above.
  8. Click “Save and Validate Destination” Button.

Page 1 of 4512345...102030...Last »