Tutorial: APPPATH has trailing slash causing 404 error in static page example |
I consider myself hardly more than a rank amateur with php and codeigniter ...
I've installed Codeigniter 3.0.0 on a raspberry Pi running Slackware. I moved the 'application' and 'system' directories above the 'htdocs' folder and made the changes to the index.php file to accommodate the relocation. That all worked (!) so I started on the tutorial with gusto ... and got as far as the "static pages". I quickly hit a "404 not found" error. I have traced it to the line in the Pages.php controller view method. The tutorial says to insert this code ... public function view($page = 'home') { if ( ! file_exists(APPPATH.'/views/pages/'.$page.'.php')) { // Whoops, we don't have a page for that! show_404(); } From inserting a print_r(APPPATH) I see my APPPATH has a TRAILING SLASH /var/www/application/ which causes the above code to have two slashes between 'application' and 'views/pages' and that causes file_exists to return false ... Is this just a typo in the tutorial, or is there some codeigniter - or php - configuration parameter that appends a trailing slash to paths ? |
Welcome Guest, Not a member yet? Register Sign In |