jeudi 30 avril 2015

Grocery CRUD 1.5.1 on CodeIgniter 3 - htaccess issue

I'm trying to learn a little abou Grocery CRUD and run into this strange situation.

I've performed a clean installation of Codeigniter3. I've configured my a virtual-host like this:

<VirtualHost *:80>
    ServerAdmin admin@codeigniter.grocery
    DocumentRoot "E:/xampp/htdocs/codeigniterGrocery"
    ServerName codeigniter.grocery
    ErrorLog "logs/codeigniter.grocery-error.log"
    CustomLog "logs/codeigniter.grocery-access.log" common
</VirtualHost>

And added a line to my file hosts, under windows.

Then I setup this htaccess after some research:

<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /

    # Remove the "index.php" part of URI
    # Remove access to "codeigniter" and "data" folders
    RewriteCond %{REQUEST_URI} ^(codeigniter|data).*
    RewriteRule ^(.*)$ /index.php?/$1 [L]

    # Block access to "hidden" directories whose names begin with
    # a period. e.g. .git, .svn
    RewriteCond %{SCRIPT_FILENAME} -d
    RewriteCond %{SCRIPT_FILENAME} -f
    RewriteRule "(^|/)\." - [F]

    # Checks to see if the user is attempting to access a valid file,
    # such as an image or css document, if this isn't true it sends the
    # request to the root index.php.
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>

Changed the config.php file's lines to:

 $config['index_page'] = '';
 $config['uri_protocol']    = 'REQUEST_URI';

Now, calling for:

  • codeigniter.grocery/welcome
  • codeigniter.grocery/index.php/welcome

Produce the same result which is the welcome page of codeigniter.

I assume that the htaccess is working then.

However if I go for codeigniter.grocery/examples I get a "service unavailable" error. If I restore the configuration to allow the use of index.php in the URL everything works fine.

I've tried changing the $config['uri_protocol'] into 'AUTO', changing the htaccess following some hints around the web but without success.

Aucun commentaire:

Enregistrer un commentaire