Welcome Guest, Not a member yet? Register   Sign In
Page not found - %20 in url
#6

(11-16-2015, 10:19 AM)mwhitney Wrote: The ucfirst() on api is not really relevant, it just means that the router went through the whole set of URI segments and couldn't find a route, with api/session_controller being the last thing it checked.

Since the router can't find your route, I'm guessing that UserName is part of the route it's trying to look up (or part of the controller/method pair), and 'User%20Name', 'User Name', and 'UserName' all require different route definitions (or one well-defined RegEx) to work properly. In most cases, I wouldn't consider spaces or %20 worth the time to support in my application, but if you need to do so, you should be able to run through the application with a debugger to make sure you know exactly what is being passed to the router in this instance, then update your route definition accordingly.

Ok - so I've added the following route to routes.php: 
PHP Code:
$route['api/session_controller/(:any)/(:any)/(:any)'] = "session_controller/$1/$2/$3"
and it works. Hallelujah. 

However - I still think there is an issue here. I shouldn't have to specify the directory name in the route. This is a hack to get around some kind of internal issue in CI (not that I care right now - its works! yay! thanks mwhitney!). All the other routes look ok without the api prepend. Not to mention that base_url includes 'api/' already.  

CI should know to try the controller first. The problem is that it thinks "api" is a controller when it is obviously not.

There issue has something to do with the space in the parameter name and also perhaps something to do with https.  

IMO routes should only be used when you are doing something clever like renaming your controllers or hiding sub directories etc.
Reply


Messages In This Thread
Page not found - %20 in url - by racerxkiwi - 11-15-2015, 09:21 PM
RE: Page not found - %20 in url - by PaulD - 11-16-2015, 08:23 AM
RE: Page not found - %20 in url - by racerxkiwi - 11-16-2015, 02:02 PM
RE: Page not found - %20 in url - by InsiteFX - 11-16-2015, 09:24 AM
RE: Page not found - %20 in url - by mwhitney - 11-16-2015, 10:19 AM
RE: Page not found - %20 in url - by racerxkiwi - 11-16-2015, 02:11 PM
RE: Page not found - %20 in url - by mwhitney - 11-17-2015, 09:41 AM



Theme © iAndrew 2016 - Forum software by © MyBB