[eluser]yannyannyann[/eluser]
Hi everybody,
If this can be helpful to somebody:
I followed the codeigniter video tutorial to build up a CMS from Haughin (google it, you will find it).
I ended up with that code in routes.php:
Code:
$exclude = array(
'.',
'..',
'index.html',
'pages.php'
);
$handle = opendir(APPPATH.'controllers/');
while( false !== ($file = readdir($handle)))
{
if( !in_array($file, $exclude))
{
if ( !is_dir(APPPATH.'controllers/'.$file) )
{
$file = substr($file, 0, strlen($file) - 4);
}
$installed_modules[] = $file;
}
}
closedir( $handle );
foreach ($installed_modules as $module) {
// e.g. controler/
$route[$module] = $module;
// e.g. controler/view/param
$route[$module.'/(.*)'] = $module.'/$1';
}
$route['(.*)'] = "pages/index/$1";
So with this, if you have a folder called "public" and if you want to have a page called "publicsomething" like "publication", the default set up will not allow it.
You will need to edit your htaccess file, by adding a SLASH after the public folder :
Code:
RewriteEngine on
RewriteCond $1 !^(index\.php|public\/|robots\.txt|favicon\.ico)
RewriteRule ^(.*)$ index.php/$1 [L]