去掉CodeIgniter URL中的Index.php

去掉CodeIgniter URL中的Index.php,php,mysql,apache,.htaccess,codeigniter,Php,Mysql,Apache,.htaccess,Codeigniter,如何从URL中删除“index.php” 描述 使用CI构建一个简单的MySQL Php应用程序,我无法摆脱URL中的“index.Php”标记: localhost/CodeIgniter/index.php/Defult\u Controller/index .htaccess application/.htaccess和application/cache/.htaccess: <IfModule mod_rewrite.c> # !IMPORTANT! Set your Re

如何从URL中删除“index.php”

描述 使用CI构建一个简单的MySQL Php应用程序,我无法摆脱URL中的“index.Php”标记:

localhost/CodeIgniter/index.php/Defult\u Controller/index

.htaccess
application/.htaccess
application/cache/.htaccess

<IfModule mod_rewrite.c>

# !IMPORTANT! Set your RewriteBase here and don't forget trailing and leading
#  slashes.
# If your page resides at
#  http://www.example.com/mypage/test1
# then use
# RewriteBase /mypage/test1/

RewriteEngine On
RewriteBase /CodeIgniter/
RewriteCond %{REQUEST_URI} ^system.*
RewriteCond $1 !^(index\.php|images|js|uploads|css|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>

<IfModule !mod_rewrite.c>
# If we don't have mod_rewrite installed, all 404's
# can be sent to index.php, and everything works as normal.
# Submitted by: ElliotHaughin

ErrorDocument 404 /index.php
</IfModule>
application/config/config.php
PS:Im使用codeIgniter 2.5.1和xampp 3.2.1您需要将
.htaccess
放在根文件夹中以删除
index.php
应用程序/.htaccess
是为了避免目录视图。

当您转到
本地主机/codeIgniter/Defult\u控制器/
时会发生什么?404?@kasun推荐描述中的截图。找不到对象!在此服务器上找不到请求的URL。如果您手动输入URL,请检查拼写并重试。如果您认为这是服务器错误,请联系网站管理员。错误404 localhost Apache/2.4.7(Win32)OpenSSL/0.9.8y PHP/5.4.22请检查此链接如果我没有错,您需要将
.htaccess
放在根文件夹中以删除
index.PHP
应用程序/.htaccess
以避免目录查看。
LoadModule rewrite_module modules/mod_rewrite.so
$config['base_url'] = "http://localhost/CodeIgniter/";
$config['index_page'] = '';