【发布时间】:2014-10-29 13:13:05
【问题描述】:
我知道这个问题已经被问过很多次了,但我确实搜索了很多,但没有找到答案。所以我希望有人能帮助我。我有一个共享主机,并且我希望在 public_html 文件夹中安装我的 CI 应用程序。子目录名称为“hrms”。
所以我将所有 CI 文件上传到 hrms。现在,当我访问http://www.example.com/hrms/index.php/login/do_login 时,我得到了著名的错误No input file specified. 我已经尝试使用 .htaccess 文件,其中有几个我可以找到的变体,但没有一个有帮助。 http://www.example.com/hrms/index.php 工作正常,所以我猜所有配置都正常。
我做错了什么?另外,.htaccess 文件是否必须,即使我打算通过完整 URL 访问该站点?
==== .htaccess =====
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /hrms
#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 ^(.*)$ /hrms/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 ^(.*)$ /hrms/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 ^(.*)$ /hrms/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>
【问题讨论】:
-
你是否在 index.php 之前的 htaccess 中包含了你的目录名...
-
我猜不是。你能给我指出一个适合我的好示例 .htaccess 吗?
-
你能不能把你的帽子密码给我修改一下
-
@Amir Done,请检查。
-
您是否更改了您的
$config['base_url']?我删除了我的答案,因为你的答案是正确的
标签: .htaccess codeigniter codeigniter-2