Reputation: 1126
I want to remove particular module name from the url in codeigniter application.
My URLs:
http://app.example.loc/admin/index/
http://app.example.loc/members/index/
http://example.loc/funnel/index/
So I just want to remove members and funnel from URL which is basically module name.
My htaccess code:
DirectoryIndex index.php
RewriteEngine on
RewriteCond $1 !^(index\.php|members|funnel|(.*)\.swf|forums|images|css|downloads|jquery|js|robots\.txt|favicon\.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php?$1 [L,QSA]
But it gives me an error.
My route.php code:
switch ($_SERVER['HTTP_HOST']) {
case 'app.example.loc':
// Members routing
$route['default_controller'] = "members/index";
$route['members/(:any)/(:any)/(:any)'] = "members/$1/$2/$3";
// Admin routing
$route['admin/(:any)/(:any)/(:any)'] = "admin/$1/$2/$3";
break;
default:
// Funnel routing
$route['default_controller'] = "funnel/index";
$route['funnel/(:any)/(:any)/(:any)'] = "funnel/$1/$2/$3";
break;
}
So basically I'm trying to redirect all traffic of admin module on /admin URL and for members want to load url without /members/ . (Same case for funnel)
Upvotes: 1
Views: 101