16 de ago de 2016

Habilitar reescrita de URL do Codeigniter 3 no Apache


Modificar .htaccess da raiz do Codeigniter para:

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


Modificar o config.php:

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


Habilidar mod_rewrite

a2enmod rewrite

Modificar apache2.conf.
<Directory /var/www/>
        Options FollowSymLinks
        AllowOverride All
        Require all granted

        <LimitExcept GET POST HEAD>
                deny from all
        </LimitExcept>
</Directory>

Reiniciar apache

/etc/init.d/apache2 restart

Nenhum comentário:

Postar um comentário