我使用CodeIgniter 2.2.0和AppServ 2.5.10作为本地服务器。 在config.php中,我确定来自:$ config [' index_page'] ='&#39 ;; 这是根文件夹(护理)中的.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欢迎页面出现了!而不是欢迎控制器应该是它!
答案 0 :(得分:0)
我的.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>
答案 1 :(得分:0)
从httpd.conf
禁用了mod_rewrite模块答案 2 :(得分:0)
将此代码写入.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]