Major weirdness, sudden 404 with no changes. |
[eluser]awpti[/eluser]
http://www.onlytechnews.com/ Page works fine. http://www.onlytechnews.com/devblog/2 ^^ Was working last night. I get up and it's kicking back a 404. No code changes have been made, all files are there. Hell, it was working this morning while I was in the middle of writing a new post (which hasn't been finished now!) routes.php Code: $route['default_controller'] = 'otn_front'; config.php Code: $config['base_url'] = "http://www.onlytechnews.com/"; otn_front.php Code: class Otn_front extends Controller { I'm completely stumped. If you go to onlytechnews.com/otn_front/devblog/ - it boots you back to the front with a redirect. So the method works.. It's as if my route is being ignored.
[eluser]Rick Jolly[/eluser]
The line: $this->uri->segment(2); would return "devblog", not the id. I think you need to use $this->uri->rsegment(2);
[eluser]awpti[/eluser]
Right. If you go to http://onlytechnews.com/otn_front/devblog/ the actual URI is http://onlytechnews.com/devblog/# That's what's not working. http://onlytechnews.com/otn_front/devblog/ is to show that the method is picking up that it was called with no valid ID (fails ctype_digit() check).
[eluser]awpti[/eluser]
Only thing that I can figure is that my routes.php is being ignored. I don't get why that would be, since routes breaking would essentially break everything else. http://www.awpti.org/ works fine as do the routes. ./stumped
[eluser]Pascal Kriete[/eluser]
Careful with the ctype_digit(). It only works if you pass in a string. Because of the way php handles variables it might already be an int. I can't test it right now, but try doing $id = settype($id, "int"); EDIT: Actually, your best bet would probably be is_numeric($id)
[eluser]awpti[/eluser]
Something broke in the Routes class. I dropped a new Routes file from a fresh CI base install and everything is working again. Maybe I got drunk and editted the file while playing WoW. Who knows. PHP generally - always in my experience - handles numerical data passed via get/post as strings. I should get into the habit of typecasting, since it will, eventually, become important (If I recall, PHP6 is getting a bit more strict on typecasting). *shrug* Color me dumbfounded. |
Welcome Guest, Not a member yet? Register Sign In |