This is the most simple way I can ask this question as I have not fully understood what's going on, or what I am not doing right.
I'm having trouble with the url.
http://localhost/index.php/user is the same as
http://localhost/index.php/user/something is not the same as
How do I make
Does it have to be
http://localhost/user/something, how do I make that work?
You need to understand how CodeIgniter's URLs work.
An URL consists of some segments.
http://localhost/index.php/user/something/thingIn this example
thingare segments of the URL.
Segments of the URL indicate which controller and which method of that controller will run.
http://localhost/index.php/user/something/thingIn this example the method
usercontroller is called and
thingis passed to that method as a parameter.
The first segment of the URL indicates the controller.
The second segment of the URL indicates the method of that controller.
The following segments are sent to that method as parameters.
But there are some defaults.
If your URL is
http://localhost/index.php/something, you have
somethingspecified as the controller, but because you have not specified any method, the default method which is
indexis called. So the above URL is the same as
If your URL is
http://localhost/index.php/, you don't have any segments specified (no controller and no method). So the default controller which is specified in
application\config\routes.phpis the loaded controller. Which method of that controller will be called? Of course the
--You can set the default controller by changing
$route['default_controller'] = "site";to what ever fits your application in
If you want
http://localhost/user/somethingto be the same as
http://localhost/index.php/user/something, you have to create custom routes for your application. More info on that here.
The content is written by members of the stackoverflow.com community.
It is licensed under cc-wiki