Skip to main content

CodeIgniter redirect examples.

<?php

  // Load the Lib
  $this->load->helper('url');

  // Permanent Redirect (301)
  redirect('/checkport/tcp', 'location', 301);

  // Refresh Redirect
  if ($logged_in == FALSE) {
    redirect('/login/form/', 'refresh');
  }

  // Default redirect (302)
  redirect('/otherurl/page/');

?>