我发现在托管服务器上的子目录中访问控制器/功能非常困难,但它在localhost上运行良好 这是我的文件夹结构 abc.com httpdocs资料 CMS 的.htaccess 应用 调节器 页面(其控制器超出子目录) admin(其子目录) 用户(管理员子目录中的控制器不可访问) 如果我通过网址访问它:abc.com/gms/admin/user/test它给了我 未找到 请求的文件没有在此服务器上找到。 唯一可以访问的是 abc.com/gms(它访问页面/索引控制器/函数)任何其他URL给我找不到错误 来自.htaccess的代码
<IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine On
RewriteBase /gms
#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 $1 !^(index\.php|images|css|js|robots\.txt|favicon\.ico)
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>
来自routes.php的代码:
$route['default_controller'] = "page";
$route['404_override'] = '';
来自config.php的代码
$config['base_url'] = '';
$config['index_page'] = '';
请建议我真的想要完成任务,因为它超过3天我无法继续托管服务器,是的mod_rewrite已启用。
答案 0 :(得分:0)
。的httpd.conf
检查根设置
AllowOveride all