Knowledgebase: Technical Information
How to redirect all 404 pages to the Home Page
Posted by Andrew G., Last modified by Andrew G. on 04 August 2014 01:45 AM

Greetings from Intelliants!

Instructions for redirecting all 404 pages to the Home Page:

1) Open ROOT/includes/classes/ia.core.view.php file

2) Insert this code:

a) for 2.3.7 version of the Subrion script:

  $this->iaCore->util()->go_to(IA_URL);

before the line:

  $this->iaCore->startHook('phpCoreDefinePage404', array('page' => &$page));

b) for 3.0.x versions of the Subrion script:

  if (self::ACCESS_FRONT == $iaView->getAccessType() && $errorCode == self::ERROR_NOT_FOUND)

  

iaUtil::go_to(IA_URL);

  }

after the line:

  $iaCore->startHook('phpCoreBeforePageDisplay');

c) for 3.1.0, 3.1.1, 3.1.2 versions of the Subrion script:

  if (iaCore::ACCESS_FRONT == $iaView->iaCore->getAccessType() && $errorCode == self::ERROR_NOT_FOUND)

  {

iaUtil::go_to(IA_URL);

  }

after the line:

  $iaCore->startHook('phpCoreBeforePageDisplay'); 

d) for 3.1.3 and abover versions of the Subrion script:

if (iaCore::ACCESS_FRONT == $iaView->iaCore->getAccessType() && $errorCode == self::ERROR_NOT_FOUND)

{

$iaCore->factory('util');

iaUtil::go_to(IA_URL);

 }

before the line:

if (self::ERROR_UNAUTHORIZED != $errorCode && iaCore::ACCESS_ADMIN != $iaCore->getAccessType())

3) Save changes.

Now all the 404 pages will be redirected to Home Page.

You need to do it if, for example, before the installation of the Subrion script on the same URL you had another script and many pages were indexed by Google. 

NOTE. It will be very difficult to track real 404 error page it you have this redirection.

(5 vote(s))
Helpful
Not helpful

Comments (0)
Post a new comment
 
 
Full Name:
Email:
Comments:
CAPTCHA Verification 
 
Please enter the text you see in the image into the textbox below (we use this to prevent automated submissions).