Welcome Guest, Not a member yet? Register   Sign In
Hard-coded path in news tutorial Pages class results in 404 error
#1

[eluser]Unknown[/eluser]
This is related to topic 209923, but my issue is not the same user setup issue.

I just ran into the same issue - 404 error with the news tutorial.

I had my base_url set properly; I had also changed my application directory and my system directory, as described in the install documentation.
Quote:If you wish to increase security by hiding the location of your CodeIgniter files you can rename the system and application folders to something more private. If you do rename them, you must open your main index.php file and set the $system_folder and $application_folder variables at the top of the file with the new name you've chosen.

Turns out, the Pages class has a hard-coded path to application:

Code:
class Pages extends CI_Controller
{

  public function view($page = 'home')
  {
    if ( ! file_exists('application/views/pages/'.$page.'.php'))
    {
      // Whoops, we don't have a page for that!
      show_404();
    }

I changed application to APPPATH, as it is in many of the other files:
Code:
class Pages extends CI_Controller
{

  public function view($page = 'home')
  {
    if ( ! file_exists(APPPATH.'/views/pages/'.$page.'.php'))
    {
      // Whoops, we don't have a page for that!
      show_404();
    }

and the page loaded fine.




Theme © iAndrew 2016 - Forum software by © MyBB