[eluser]markanderson993[/eluser]
Hello Codeigniter experts, I hope my question is simple enough. Basically, I would like my routing script to detect if the requested uri is /# and re-route the user to the home page, else carry on with another set of instructions.
Here is my code
Code:
if ($_SERVER['REQUEST_URI'] == '/#') {
$route['([a-zA-Z0-9_-]+)(.*)'] = "home/index";
} else {
$controllers = array();
if($controller_dir = opendir(APPPATH . 'controllers'))
{
while(false !== ($file = readdir($controller_dir)))
{
if(preg_match('/(.*?)\.php$/i',$file,$file))
{
$controllers [] = $file[1];
}
}
}
else
{
log_message('error','Could not read controllers directory at |' . APPPATH . 'controllers');
}
foreach($controllers as $controller)
{
$route[$controller . '(.*?)'] = $controller . "$1";
}
$route['([a-zA-Z0-9_-]+)(.*)'] = "profile/index/$1";
}