[英]Remove index.php from CodeIgniter
我正在使用CodeIgniter 2.2.0和AppServ 2.5.10作为本地服务器。 在config.php中,我确定来自:$ config ['index_page'] =''; 这是根文件夹(护理)中的.htaccess:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /nursing/
#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]
</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>
当我尝试转到:localhost / nursing / welcome / index时,出现了AppServ欢迎页面!,而不是应有的欢迎控制器!
我的.htaccess在这里:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond $1 !^(index\.php|templates|payment\.php)
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
<IfModule !mod_rewrite.c>
ErrorDocument 404 /index.php
</IfModule>
mod重写模块已从httpd.conf禁用
在.htaccess中编写此代码
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/system.*
RewriteRule ^(.*)$ index.php?/$1 [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ index.php?/$1 [L]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.