Welcome Guest, Not a member yet? Register   Sign In
Major weirdness, sudden 404 with no changes.


Page works fine.


^^ 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!)

$route['default_controller']    = 'otn_front';
$route['devblog/:num']          = 'otn_front/devblog';
$route['devblog']               = 'otn_front/devblog';
$route['scaffolding_trigger']   = "";

$config['base_url']     = "http://www.onlytechnews.com/";

$config['index_page'] = "";

$config['uri_protocol'] = "AUTO";

$config['url_suffix'] = "";

$config['language']     = "english";

$config['charset'] = "UTF-8";

$config['enable_hooks'] = FALSE;

$config['subclass_prefix'] = 'MY_';

$config['permitted_uri_chars'] = 'a-z 0-9~%.:_-';

$config['enable_query_strings'] = FALSE;
$config['controller_trigger'] = 'c';
$config['function_trigger'] = 'm';

$config['log_threshold'] = 1;

$config['log_path'] = '';

$config['log_date_format'] = 'Y-m-d H:i:s';

$config['cache_path'] = '';

$config['encryption_key'] = "***********";

$config['sess_cookie_name']             = 'otn_web';
$config['sess_expiration']              = 7200;
$config['sess_encrypt_cookie']  = FALSE;
$config['sess_use_database']    = FALSE;
$config['sess_table_name']              = 'ci_sessions';
$config['sess_match_ip']                = FALSE;
$config['sess_match_useragent'] = TRUE;

$config['cookie_prefix']        = "";
$config['cookie_domain']        = "";
$config['cookie_path']          = "/";

$config['global_xss_filtering'] = TRUE;

$config['compress_output'] = FALSE;

$config['time_reference'] = 'local';

$config['rewrite_short_tags'] = FALSE;

class Otn_front extends Controller {

        function Otn_front()
                // Not necessary, but good practice anyway.

                //Setup the view parts.
                $this->view->part('tpl_header',         'template/tpl-header.php');
                $this->view->part('tpl_right_content',  'template/tpl-right-content.php');
                $this->view->part('tpl_footer',         'template/tpl-footer.php');

                $this->load->model('otndb', '', TRUE);
                // $this->load->model('devblogdb', '', TRUE);

                //Get the menu items, this needs to be done everywhere.
                $this->view->set('otn_devblog_menu', $this->otndb->get_devblog_menu());
                // $this->view->set('otn_devblog_menu_items', $this->devblog->get_menu_items());

                // This output cache will be put into place once the site is live
                // --AND-- getting significant enough traffic to affect performance.


        function index()
                $this->view->set('otn_front_content', $this->otndb->get_devblog_latest(4));

        function devblog()
                $id = $this->uri->segment(2);
                        $this->view->set('otn_devblog_single', $this->otndb->get_devblog_single($id));


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:

would return "devblog", not the id.

I think you need to use $this->uri->rsegment(2);

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).

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)

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).


Color me dumbfounded.

Theme © iAndrew 2016 - Forum software by © MyBB