Codeigniter . htaccess remover index.php

Asked

Viewed 9,412 times

2

Starting working with Codeigniter and want to remove the index.php of URLS:

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

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

  1. This in the folder application
  2. This in the folder sytem
  3. This in the folder public_html

Which to use to remove index.php, using this code:

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

2 answers

2


You should put out of any folder, ie at the root of the framework:

application/
assets/
system/
.htaccess
index.php

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

$config['index_page'] = "index.php";
$config['index_page'] = "";
  • Grateful, Friend!

  • Solved the problem? Mark this answer as accepted to help other users. Here’s how to make one tour! @Sedineyschuster

  • and needs to enable mod_rewrite link

0

In some cases also add:

RewriteEngine On
RewriteBase /pasta/

It happened to me, I spent hours to solve.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.