简体   繁体   中英

How to cache routes.php in Codeigniter

I have e-commerce web site and which has about 9000 item and am trying to make each of them SEO coherent. So here is my route codes. But as you predict which will make my site slower and.using caches all routes may solve my problem.

$route['default_controller'] = 'home';
$route['404_override'] = '';
$route['translate_uri_dashes'] = FALSE;

require_once(BASEPATH .'database/DB.php');
require_once(APPPATH . 'helpers/tools_helper.php');
$db = &DB();
$query = $db->get('urunler');
$result = $query->result();
//echo"<pre>";print_r($result);exit;

foreach($result as $sonuc){

   $route[convertToSEO($sonuc->Urun_adi)]  = "urunler/urun/".$sonuc->Urun_kodu;
}

but I dont know what i am going to do!

Why you can not do it with just controllers ?

class urunler extends CI_Controller{
    public function urun($id){
        //code
    }
}

Going throught this tutorial may helpful to you.

SEO is one of codeigniter's features. From Codeigniter documentation

Features

Search-engine Friendly URLs

Also take a look at this guid on URI Routing

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM