We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

404 + routes

Development and Programming

jamojo's avatar
jamojo
3 posts
11 years ago
jamojo's avatar jamojo

Hi Everyone,

In my route.php, i have this setting below. This will use the parameter to retrieve page urls in the database

$route['(:any)'] = 'page/index/$1';

In the Page controller, I have this below:

class Page extends CI_Controller {
 function __construct() {
  parent::__construct();
 }
 public function index( $page )
 {
  $data = array();
  $page_data = $this->page_model->getPageData( $page );
  if ( !empty( $page_data ) )
  {
   $data = array(
    'page' => $page,
    'page_data'    =>  $page_data,
   );
  }
  else
  {
   $data = $this->page_model->getUnavailableData();
  }
  $this->load->view('main', $data);
 }
}

For example, if the page is www.site.com/about its a valid data. But if the url is www.site.com/about-me, it did not go to the 404 page set in the routes.php. I tried to comment the

$data = $this->page_model->getUnavailableData();

but it cause errors in the page.

Can you please advise what is the best approach for this. Google Webmaster Tool is telling that the site got increase of 404 urls.

Thanks in advance.

       
Boyink!'s avatar
Boyink!
5,011 posts
11 years ago
Boyink!'s avatar Boyink!

Might try the CI forums..😉

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.