【发布时间】:2014-01-04 21:00:35
【问题描述】:
我是 Codeigniter 的新手,在上传我的网站时,默认控制器/视图显示正常。但是,当我尝试打开其他页面时,会出现以下错误
“未指定输入文件。”
。令我困惑的是,这在 localhost 中运行良好。
我在这个论坛上阅读过有关更改 htaccess 文件的信息,但我不知道要更改哪个 htaccess 文件以及如何更改。
请帮忙
提前致谢
【问题讨论】:
标签: .htaccess codeigniter
我是 Codeigniter 的新手,在上传我的网站时,默认控制器/视图显示正常。但是,当我尝试打开其他页面时,会出现以下错误
“未指定输入文件。”
。令我困惑的是,这在 localhost 中运行良好。
我在这个论坛上阅读过有关更改 htaccess 文件的信息,但我不知道要更改哪个 htaccess 文件以及如何更改。
请帮忙
提前致谢
【问题讨论】:
标签: .htaccess codeigniter
您更改根目录(系统、应用程序文件夹所在的位置)中的.htaccess,在任何文本编辑器中对其进行编辑并将其另存为.htaccess。
.htaccess的例子如下
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
#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 %{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.
ErrorDocument 404 /index.php
</IfModule>
如果您打算从您的 url 中删除 index.php,请在 application/config 文件夹中找到 config.php 文件并编辑如下几行
$config['base_url'] = 'http://yourdomainhere.com.uk.alien.org';
$config['index_page'] = ''; //make this blank
编辑
.htaccess 文件必须是 Unix LF only 样式。如果您使用记事本或写字板并上传 CR/LF 样式的 .htaccess 文件,它将无法正常工作。
【讨论】: