codeigniter sub folder remove index.php with .htaccess

edit file /etc/apache2/apache2.conf

sudo nano /etc/apache2/apache2.conf

in default root directory, ex /var/www

<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted

edit to

<Directory /var/www/>
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted

and make .htaccess file in codeigniter sub project/folder

let say our sub folder is /var/www/html/project1

nano /var/www/html/project1/.htaccess

and copy this code to .htaccess

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

restart apache

sudo service apache2 restart

Published by


just to remember what i had known :)

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s