Reputation: 415
I know how to set up routes for the most part but instead of listing out 50 or so different routes for only one thing I want to change is redundant.
I havemy file system setup like this for my codeigniter application.
-application
-controllers
-admin
login.php
register.php
dashboard.php
As of right now when I go to the following site it shows up the way it should.
http://www.mysite.com/admin/(login,register, dashboard)
However I'd like to manipulate the route to appear as the following without having to change the name of the folder in the file structure.
http://www.mysite.com/my-project/(login,register, dashboard)
Upvotes: 0
Views: 77
Reputation: 3675
Is "my-project" a permanent part of your siteurl, for every single page? Then change your base_url() in the config.
Otherwise:
if your base_url is http://www.mysite.com
and you want to go to http://www.mysite.com/my-project/login
then you set the route to be:
$routes['my-project/(:any)'] = 'admin/$1';
or if only for those three:
$routes['my-project/('login'|'register'|'dashboard')] = 'admin/$1';
SHOULD work, although I don't have a handy way to test at the moment
Upvotes: 1