Reputation: 9778
I just thought of routing my URLs which is like
http://localhost/codeigniter_cup_myth/index.php/adminController/mainAccount
and it would be pretty nice if it was
http://localhost/codeigniter_cup_myth/Accounts/mainAccount
Where should I start when routing URLs in my web application?
Upvotes: 0
Views: 1947
Reputation: 11
u can check woo url routing component
woo url routing feature:
Upvotes: 1
Reputation: 2846
Routes are defined as such:
$route['product/:num'] = "catalog/product_lookup";
where product
/ anynumber
is your URL: http://www.example.com/product/234. The second part is the controller/method. The URL we're talking about here would call the catalog controller's product_lookup method.
$route['accounts/mainaccount'] = "adminController/mainAccount"
Would fire what you're looking for. Take a look at the CodeIgniter User Guide for more examples.
I use this .htaccess
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php?/$1 [L]
Which allows any physically existing file to be accessed, all else is routed to CI.
Upvotes: 3
Reputation: 679
Also, adding something like:
RewriteEngine on
RewriteCond $1 !^(index\.php|images|css|js|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
to your .htaccess file will get rid of the index.php part
Upvotes: 2