从CodeIgniter中删除index.php时遇到问题

从CodeIgniter中删除index.php时遇到问题,php,apache,.htaccess,codeigniter,Php,Apache,.htaccess,Codeigniter,到目前为止,我有一个新安装的2.1.3,并放置了一个.htaccess文件,其中包含: RewriteEngine on RewriteCond $1 !^(index\.php|images|robots\.txt) RewriteRule ^(.*)$ /index.php/$1 [L] 在根目录中,与应用程序、系统等处于同一级别 编辑的$config['index_page']='index.php';到 $config['index_page']=;在application\confi

到目前为止,我有一个新安装的2.1.3,并放置了一个.htaccess文件,其中包含:

RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]
在根目录中,与应用程序、系统等处于同一级别

编辑的$config['index_page']='index.php';到 $config['index_page']=;在application\config\config.php中。 打开“重写”模块。 重新启动Apache。
但即使尝试了所有的解决方案,我还是得到了404,即使是那些相关帖子中的人。

您需要修改httpd.conf以启用mod_rewrite,并确保您的webroot目录已将AllowOverride设置为“ALL”

您需要修改httpd.conf以启用mod_rewrite,并确保您的webroot目录已将AllowOverride设置为“ALL”

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]
用这个它会有用的


使用它会起作用的

希望这能对我有所帮助这是我的htaccess,它适合我

重新启动发动机 基准/编码点火器/

#Removes access to the system folder by users.
#Additionally this will allow you to create a System.php controller,
#previously this would not have been possible.
#'system' can be replaced if you have renamed your system folder.
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]

#When your application folder isn't in the system folder
#This snippet prevents user access to the application folder
#Submitted by: Fabdrol
#Rename 'application' to your applications folder name.
RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /index.php?/$1 [L]

#Checks to see if the user is attempting to access a valid file,
#such as an image or css document, if this isn't true it sends the
#request to index.php
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

希望这能对我有所帮助这是我的htaccess,它对我有用

重新启动发动机 基准/编码点火器/

#Removes access to the system folder by users.
#Additionally this will allow you to create a System.php controller,
#previously this would not have been possible.
#'system' can be replaced if you have renamed your system folder.
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]

#When your application folder isn't in the system folder
#This snippet prevents user access to the application folder
#Submitted by: Fabdrol
#Rename 'application' to your applications folder name.
RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /index.php?/$1 [L]

#Checks to see if the user is attempting to access a valid file,
#such as an image or css document, if this isn't true it sends the
#request to index.php
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

RewriteCond$1,这里的$1是什么?@Akam他使用的是文档中提供的标准代码,您的站点结构是什么?public\u html/site或just public\u htmlI还没有做任何事情,到目前为止,我正在尝试运行localhost/welcome,而不是localhost/index.php/welcome.RewriteCond$1,这里的$1是什么?@Akam他正在使用文档中提供的标准代码,你的站点结构是什么?public\u html/site或just public\u htmlI还没有做任何事情,到目前为止,我尝试运行localhost/welcome,而不是localhost/index.php/welcome。我已经做了。LoadModule rewrite\u module modules/mod\u rewrite.so未注释。您的webroot是否已将AllowOverride设置为“全部”?是的,我已将其设置为“全部”。我已经设置了。LoadModule rewrite\u module modules/mod\u rewrite.so未注释。您的webroot是否已将AllowOverride设置为“全部”?是的,我已将其设置为“全部”。请将您的htaccess文件与index.phpp放在一起。请将您的htaccess文件与index.php放在一起