Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Codeigniter 3 Remove index.php Problems

I have a little project that i developed for a client in codeigniter 2.1.4 and now, he insists to migrate to codeigniter 3 DEV version. I know that's not a good ideea but... My problem is that i can't remove the index.php from the url.

This is my .htaccess file :

  Options +FollowSymLinks
  RewriteEngine on

  # Send request via index.php
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ index.php?/$1 [L]

I have removed the index.php from the config.php file
No luck
I reinstalled the LAMP server (i'm on Ubuntu 12.04'), reconfigured
I have other projects on my local server developed on Codeigniter 2.1.4 and Laravel 4 and they work just fine but this one it's killing me.
Thank you!

like image 526
Chiribuc Avatar asked Nov 24 '13 00:11

Chiribuc


People also ask

Why is index php in my wordpress URL?

The most common reason for index. php appearing is improper permalink structure. Therefore first check if the structure is set properly. To check it, navigate to Settings -> Permalinks.

Where is .htaccess file in CodeIgniter?

You should place your . htaccess file at your root directory not Inside the application folder.

What is htaccess in CodeIgniter?

htaccess file in CodeIgniter. htaccess is the shortened used for Hypertext Access, which is a powerful configuration file that controls the directory “. htaccess”. It is used by Apache based web servers to control various server features.


1 Answers

I made this way:

Created the .htaccess in the root folder of the project with the content:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond $1 !^(index\.php|css|js|images|robots\.txt)
RewriteRule ^(.*)$ index.php?$1 [L]

Then, in the config.php i modified this line.

From:

$config['url_suffix'] = 'index.php';

To:

$config['url_suffix'] = '';
like image 91
Eduvm Avatar answered Sep 29 '22 08:09

Eduvm