How can you remove index.php from URL in Codeigniter?


Posted On: Feb 22, 2018


    1 Answer Written

  •  devquora
    Answered by Rajalakshmi

    In CodeIgniter by default, the index.php file will be included with the URLs. But you can easily remove the index.php from the URL doing follwing changes

    Steps to remove index.php codeigniter 3

    #1 Change the $config['index_page'] = "index.php" to $config['index_page'] = "" from config.php file.

    #2 Create .htaccess file and add the following code

    RewriteEngine on
    RewriteCond $1 !^(index\.php|resources|robots\.txt)
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php/$1 [L,QSA]

    That's It you have done

Related Questions

Please Login or Register to leave a response.

Related Questions

CodeIgniter Interview Questions

How to check the version of CodeIgniter framework?

How to check the version of CodeIgniter framework?..