开发者

cannot remove index.php in CodeIgniter application

开发者 https://www.devze.com 2023-03-19 06:17 出处:网络
I\'m deploying the web 开发者_JAVA百科application that we made in our live server but then im having troubles in figuring out how to remove index.php.

I'm deploying the web 开发者_JAVA百科application that we made in our live server but then im having troubles in figuring out how to remove index.php. i have read several blogs regarding how to remove index.php in codeigniter application.

i have tried this settings on my .htaccess

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

and on my config.php

$config['index_page'] = '';

$config['uri_protocol'] = 'REQUEST_URI';

but i still can't figure out how to remove it. Do i need to edit something in the apache httpd.conf?

thanks!


Can you try removing the ? that is present after index.php in your .htaccess:

Change:

RewriteRule ^(.*)$ index.php?/$1 [L]

To:

RewriteRule ^(.*)$ /index.php/$1 [L]


This is the one I use. Tried 3 different ones before I found one that worked

DirectoryIndex index.php
RewriteEngine on

RewriteCond $1 !^(index\.php|(.*)\.swf|forums|images|css|downloads|js|robots\.txt|favicon \.ico)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ ./index.php?$1 [L,QSA] 
0

精彩评论

暂无评论...
验证码 换一张
取 消