我开了一个codeigniter网站。我的默认控制器是$route' default _ controller‘= "login";在routes.php中
在config.php中,我的基本URL是$config' base _url‘= 'http://digimed.net/sandbox/';
场景A我在URL栏中输入http://digimed.net/sandbox/,如期获得登录控制器的索引方法。
场景B我输入了类似于http://digimed.net/sandbox/login的内容,当我期望得到与场景A相同的结果时,我得到了一个404错误。
事实上,我不能访问登录控制器中的任何函数。我每次都会收到404错误。
在路线或会议中有什么需要更改的吗?
谢谢
发布于 2011-07-03 07:19:20
如果任何人感兴趣,我通过在网站路由目录( codeigniter路由目录所在的位置)中添加以下.htaccess文件解决了这个问题。
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /system_admin
#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]
#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
#This last condition enables access to the images and css folders, and the robots.txt file
#Submitted by Michael Radlmaier (mradlmaier)
RewriteCond $1 !^(index\.php|images|robots\.txt|css)
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>https://stackoverflow.com/questions/6560040
复制相似问题