Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Remove index.php in URL

I try to remove the index page in Codeigniter

the first step I do this //old Code

$config['index_page'] = "index.php”

//New updated code(Only Need to remove index.php )

$config['index_page'] = ""

then for second step i do this creat file .htaccess in root of codigniter then put this code source

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

but it's the same problem and I can't refresh the web page

with index page the URL work: http://localhost:8089/codeigniter3/index.php/Hello/dispdata but without index page don't work http://localhost:8089/codeigniter3/Hello/dispdata

Hello is the controller, finally thank for help, :)

like image 204
JEEdz Avatar asked Mar 03 '23 21:03

JEEdz


1 Answers

The problem is, you installed it in /codeigniter3/

This should fix it:

// remove index.php
$config['index_page'] = ""

// Allow installation in a subfolder of your webroot
$config['uri_protocol'] = "REQUEST_URI"

And keep your rewrite settings, they are ok.

like image 200
nito Avatar answered Mar 05 '23 16:03

nito