CodeIgniter .htaccess remove index.php

2

Starting to work with CodeIgniter and want to remove index.php from URLS:

example.com/index.php/news/article/my_article

The problem is that I have the file .htaccess in 3 different places:

  • It is in the application
  • It is in the sytem
  • It is in the public_html
  • What to use to remove index.php , using this code:

    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ index.php/$1 [L]
    
        
    asked by anonymous 16.08.2015 / 12:10

    2 answers

    1

    You should put out of any folder, that is, in the framework root:

    application/
    assets/
    system/
    .htaccess
    index.php
    

    Then change the file application/config/config.php :

    $config['index_page'] = "index.php";
    $config['index_page'] = "";
    
        
    16.08.2015 / 13:06
    0

    In some cases also add:

    RewriteEngine On
    RewriteBase /pasta/
    

    It happened to me, I spent hours to solve.

        
    17.12.2018 / 16:01