Scripts

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);

How to Install WordPress?

WordPress blogging platform is well-known for its ease of installation even for beginner. The process should be very simple and should takes less than five minutes to complete.

This guide assume you are using Linux Hosting with cPanel & you have your own domain.

Step 1:- Add Domain to your cPanel Account

  1. You may skip this step is the domain already in your cPanel account.
  2. Log in to your cPanel.
  3. Click Addon Domains icon
  4. Enter your domain name, sub-domain/FTP Username & password.
  5. Remember the Document Root folder.
  6. Click Add Domain button.

Step 2:- Download & Extract WordPress Files

  1. Download the latest wordpress archive at http://wordpress.org/latest.zip to your computer.
  2. In cPanel account click on File Manager icon
  3. Browse to folder as per STEP 1 (5) above.
  4. Click Upload icon & upload the file download in (1) above.
  5. When done, select the file & click Extract icon.
  6. Browse to wordpress subfolder & click Select All
  7. Click Move icon & enter folder as per STEP 1 (5) above.
  8. When done, you may remove wordpress sub-folder.

Step 3:- Create MySQL Database

  1. In cPanel account click on MySQL Database icon.
  2. Enter database name & click Create Database button.
  3. On the same page, browse to the end & assign user to database created in (2) above.
  4. Click Add button.
  5. Tick All Privileges check-box & click Make Changes button.

Step 4:- Installation

  1. By using web browser, navigate to your domain.
  2. Click on Create Configuration File button.
  3. Click Let’s go button
  4. Enter Database name, username & password as per STEP 3. You may leave database host & table prefix as it is.
  5. Click Submit button.
  6. Click Run The Install button
  7. Enter Site Title, Username, Password, e-mail & tick Allow Search Engine to Index this site check-box.
  8. Click Install WordPress button.
  9. Installation done.
  10. You may log-in to WordPress back-end by Clicking Log in button.
  11. Start blogging!!