Welcome Guest, Not a member yet? Register   Sign In
Understanding CI URL Structure
#5

[eluser]boltsabre[/eluser]
okay, so example.com/search doees not work because of the very nature of CI URLs (you pointed it out at the start of your post -> example.com/controller/function/variable).

example.com/search wont work, because CI is looking for a controller named 'search', and if it doesn't find it it throws the error your getting (404). Setting a default controller only allows your to load your base url (www.example.com) without calling the controller name/function name (ie, application -> index). If you want to access a different function within your default controller, you then have to specify the full path.

The correct way to load your 'search' function contained in your 'application' controller is like this:

example.com/application/search.

If you don't like this URL, you can do one of three things...
1. Name a controller called search (www.example.com/search)
2. Use routes to re-route
3. Set up a .htaccess file to make a redirect

Another option, I guess, would be to make your 'application' index funtion just redirect to the search function, but then you still get the same URL as option 1 above. Hope this helps.


Messages In This Thread
Understanding CI URL Structure - by El Forum - 05-10-2011, 03:44 PM
Understanding CI URL Structure - by El Forum - 05-10-2011, 03:56 PM
Understanding CI URL Structure - by El Forum - 05-10-2011, 04:06 PM
Understanding CI URL Structure - by El Forum - 05-10-2011, 04:08 PM
Understanding CI URL Structure - by El Forum - 05-10-2011, 04:10 PM
Understanding CI URL Structure - by El Forum - 05-10-2011, 04:28 PM
Understanding CI URL Structure - by El Forum - 05-10-2011, 04:46 PM
Understanding CI URL Structure - by El Forum - 05-12-2011, 03:33 PM



Theme © iAndrew 2016 - Forum software by © MyBB