Page Redirection

There are two main methods for re-directing users:

1. By setting up a Page Redirector via the the Dashboard (admin users / clients can do this easily). 

2. By adding some code into the content of a page.

Content vs Redirection

Before setting up a page redirector, consider that a page with content is a far better contribution to a website than a page created with the intention of simply redirecting a user to another page.

A good example is the "services" page of a website. Consider the following scenario of an accounting website: 

  • Our Services
    • Personal Accounting
    • Business Accounting
    • Financial Planning
    • Tax
It is better practise to have a services page that helps guide users to the correct service, rather than a services page that simply redirects the user to the "Personal Accounting" page. Here at Oncord, these are referred to as "Navigation Pages". 


1. Configuring A Page Redirector

To add a new re-director, navigate to:
Dashboard > Pages > Redirectors > New Redirector.

This page will allow you to specify the page which will redirect the user, and the page which the user will be redirected to.

If the page will appear as an item in the navigation menu, tick the option "Visible In Navigation". 

This page also gives the option to specify an "Expire After" time, which is the number of days of inactivity required before the redirector is removed. If this field is set to 0, the redirector won't expire.

The redirection mode should be set to 301 in most cases.

2. Hard-coded Page Redirection

To hard-code a page to automatically redirect the user to an alternate page, do the following: 

1. Edit the page you need to re-direct traffic from (Dashboard > Website > Pages > Click a page to edit). 

2. Open the page source editor, by clicking the "SRC" button, located in the left sidebar.

3. Add the code below into the HTML page source, replacing '/about-us/' with the page id you would like to redirect the user to.

4. Save the page by clicking the "Save Page" button located in the top left side of the screen.

[? \Framework\HTTP\Redirection::redirect('/about-us/') ?]


Alternative Hard-coded Redirection Method: 

The solution above is preferable, because the re-direct code will be visualized in the editor - making it obvious to other admins in the future. However as an alternative approach, you can substitute the 3rd step above with the following code, pasting it into the PHP tab, rather than the HTML tab:

<?php \Framework\HTTP\Redirection::redirect('https://www.oncord.com/') ?>


You can also further extend this example, to only re-direct users in specific cases (such as if they're not logged in as an administrator):

<?php if (!(\Components\Settings\Administrators::currentIsAdministrator())){ \Framework\HTTP\Redirection::redirect('https://www.oncord.com/') } ?>