Find the answer to your Linux question:
Results 1 to 9 of 9
Hi, I'm using a LAMP server for hosting our company applications. But when I try to host projects that are done using Codeigniter framework it gives the following error while ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Linux Newbie amithad's Avatar
    Join Date
    Sep 2006
    Location
    Sri Lanka
    Posts
    160

    Question Error 404 in LAMP Server for Codeigniter Projects


    Hi,

    I'm using a LAMP server for hosting our company applications. But when I try to host projects that are done using Codeigniter framework it gives the following error while accessing sing the index.php file

    404 Page Not Found

    The page you requested was not found.
    What should I do pls? This happens only for the above mention framework projects but normal php applications runs without any problem

    Thanks

  2. #2
    Penguin of trust elija's Avatar
    Join Date
    Jul 2004
    Location
    Either at home or at work or down the pub
    Posts
    3,569
    I'm not familiar with codeigniter but most of these frameworks have the concept of internal routing. If your application is set up to route from the webroot (http://thesite) but the site is served from a subdirectory (http://thesite/somefolder), that could cause the issue.
    What do we want?
    Time machines!

    When do we want 'em?
    Doesn't really matter does it!?


    The Fifth Continent

  3. #3
    Just Joined!
    Join Date
    Jan 2012
    Posts
    4
    Do you have mod_rewrite enabled in Apache?
    Is your .htaccess is configured correctly?? In case if your application is hosted in sub-directory, you need to reconfigure the .htaccess.

    You can cross check your setup with this user guide available in CI site.

    Thanks,
    Aruns

  4. #4
    Linux Newbie amithad's Avatar
    Join Date
    Sep 2006
    Location
    Sri Lanka
    Posts
    160
    Dear All,

    Thanks for your replies. Here in a Ubuntu 10.10 OS I'm finding that the httpd.conf is empty when I try to vi and edit it. and it's in /etc/apache2 directory. Instead of httpd.conf I can find apache2.conf. There I could not find any lines that mod_rewrite has been enabled.

    About the .htaccess file there is a .htaccess file inside the Codeigniter project. There is no other .htacess files in the directory hierarchy

    Thanks

  5. #5
    Penguin of trust elija's Avatar
    Join Date
    Jul 2004
    Location
    Either at home or at work or down the pub
    Posts
    3,569
    /etc/apache2/apache2.conf is the correct file. The simplest way to see if mod rewrite is enabled is to run
    Code:
    a2enmod rewrite
    as root and if it gets enabled, bounce the service with
    Code:
    /etc/init.d/apache2 restart
    What do we want?
    Time machines!

    When do we want 'em?
    Doesn't really matter does it!?


    The Fifth Continent

  6. #6
    Linux Newbie amithad's Avatar
    Join Date
    Sep 2006
    Location
    Sri Lanka
    Posts
    160
    Thanks Elija,

    I'll try what you say. Will send the feedback.

    Thanks

  7. #7
    Linux Newbie amithad's Avatar
    Join Date
    Sep 2006
    Location
    Sri Lanka
    Posts
    160
    Quote Originally Posted by elija View Post
    /etc/apache2/apache2.conf is the correct file. The simplest way to see if mod rewrite is enabled is to run
    Code:
    a2enmod rewrite
    as root and if it gets enabled, bounce the service with
    Code:
    /etc/init.d/apache2 restart
    Did the above got the exact results as you said. restarted apache accordingly, but the same 404 error

  8. #8
    Penguin of trust elija's Avatar
    Join Date
    Jul 2004
    Location
    Either at home or at work or down the pub
    Posts
    3,569
    I'm wondering if it something to do with the configuration or the internal routing (if codeigniter uses that)
    What do we want?
    Time machines!

    When do we want 'em?
    Doesn't really matter does it!?


    The Fifth Continent

  9. #9
    Linux Newbie amithad's Avatar
    Join Date
    Sep 2006
    Location
    Sri Lanka
    Posts
    160

    Thumbs up

    Hi,

    After searching in the Internet got some solution. Inside Codeigniter project have to do the change


    If you look at the Router.php located inside system/libraries then you will find a line at number 88 where

    $this->default_controller = ( ! isset($this->routes['default_controller']) OR $this->routes['default_controller'] == '') ? FALSE : strtolower($this->routes['default_controller']);

    if you notice at the end of the ternary they are forcing a strtolower operation on the controller name. I removed that method and simply let the original name be used at this point by changing the line to this.

    $this->default_controller = ( ! isset($this->routes['default_controller']) OR $this->routes['default_controller'] == '') ? FALSE : $this->routes['default_controller'];
    But this method take some time to load the page than normal projects but doesn't give the 404 error


    Thanks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •