.htaccess do not work without index.php on CodeIgniter

Posted by Mattia on Pro Webmasters See other posts from Pro Webmasters or by Mattia
Published on 2013-10-18T15:28:40Z Indexed on 2013/10/18 16:13 UTC
Read the original article Hit count: 283

Filed under:
|

I have read a lot of topic with the same problem but I do not find the solution. I have a LAMP into Ubuntu server. My document root is /home/utente/ into this dir I have another dir (turni) with a CodeIgniter web app. The web app works fine with the index.php into the URL, but I want to eliminate it. I have this configuration:

config.php into CodeIgniter:

$config['index_page'] = '';

.htaccess:

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

/etc/apache2/sites-available/default:

<VirtualHost *:80>
    ServerAdmin webmaster@localhost

    DocumentRoot /home/utente
    <Directory />
            Options FollowSymLinks
            AllowOverride None
    </Directory>
    <Directory /home/utente/>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride None
            Order allow,deny
            allow from all
    </Directory>

    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    <Directory "/usr/lib/cgi-bin">
            AllowOverride None
            Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
            Order allow,deny
            Allow from all
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log

    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn

    CustomLog ${APACHE_LOG_DIR}/access.log combined

Alias /doc/ "/usr/share/doc/"
<Directory "/usr/share/doc/">
    Options Indexes MultiViews FollowSymLinks
    AllowOverride None
    Order deny,allow
    Deny from all
    Allow from 127.0.0.0/255.0.0.0 ::1/128
</Directory>

When I open a link of the web app without index.php into the URL, the server show me this error:

The requested URL /turni/auth/login was not found on this server.

Why? If I put the index.php like /turni/index.php/auth/login all works fine.

© Pro Webmasters or respective owner

Related posts about htaccess

Related posts about codeigniter