CodeIgniter removing index.php not working

后端 未结 4 736
悲&欢浪女
悲&欢浪女 2021-01-15 04:12

I\'m using Ubuntu 13 with the following setup for a local codeigniter site.

Apache/2.4.6 (Ubuntu)
5.5.3-1ubuntu2.2 
\'CI_VERSION\', \'2.1.2\'
4条回答
  •  花落未央
    2021-01-15 04:40

    It doesn’t seem like CodeIgniter has a default .htaccess, so unclear where that came from. But for debugging purposes, I would recommend you do the following. First, here is your .htaccess all cleaned up:

    
      RewriteEngine On
      RewriteBase /
      RewriteCond %{REQUEST_FILENAME} !-f
      RewriteCond %{REQUEST_FILENAME} !-d
      RewriteRule ^(.*)$ index.php?/$1 [L]
    
    

    Now replace your index.php with this. It just dumps the $_GET values passed via the .htaccess like so:

    echo '
    ';
    print_r($_GET);
    echo '
    ';

    Now with that in your .htaccess load the index page of the site/app/project in question. The output should be something like this:

    Array
    (
        [/controllername/here/] => 
    )
    

    Which appears to be correct. But again, you would know better than us.

    The purpose of doing this is to assess whether the issue is either in Apache passing proper $_GET values to your CodeIgniter setup, which is one issue. Or whether the issue is within your CodeIgniter controller logic itself.

    My gut tells me the issue is in the CodeIgniter logic in your codebase since the upgrade from Ubuntu 12.x to Ubuntu 13.x includes an upgraded version of PHP from version 5.3 in Ubuntu 12.x to version 5.5 in Ubuntu 13.x. I am using lots of code that works in PHP 5.3 and PHP 5.4 but breaks at times in PHP 5.5 since there are major changes in that codebase that will cause code to break if you don’t keep on top of non-depreciated functions & such.

提交回复
热议问题