In codeigniter redirecting is not working without index.php? In codeigniter redirecting is not working without index.php? codeigniter codeigniter

In codeigniter redirecting is not working without index.php?


Following things you should do for avoiding index.php in url

  • Always make sure you have .htaccess file. which you have already.

  • Include contents in .htaccess which @charlie has suggested above.

  • Edit httpd.conf file using nano command and include main thing keep allowoveride All

  • First disable rewrite mode and enable it again then restart apache2 server using following commands.

    sudo a2dismod rewrite //which disables the rewrite mode

    sudo a2enmod rewrite //which enables the rewrite mode

    sudo service apache2 restart //which restarts your apache

Thats all you need to do. All the best.


Paste this in your .htaccess file

RewriteEngine onRewriteCond $1 !^(index\.php|images|robots\.txt)RewriteCond %{REQUEST_FILENAME} !-fRewriteCond %{REQUEST_FILENAME} !-dRewriteRule ^(.*)$ index.php/$1 [L,QSA]