我是Codeigniter的新手,当我的网站上传时,默认的控制器/视图显示正常。但是,当我尝试打开其他页面时,它会出现以下错误
“未指定输入文件。”
。令我困惑的是,这在localhost中运行良好。
我在这个论坛上已经阅读过有关更改htaccess文件但我不知道哪个htaccess文件要更改以及如何更改。
请帮助
提前致谢
答案 0 :(得分:0)
您更改根目录中的.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>
如果您的目标是从网址中删除index.php,请在config.php
文件夹中找到application/config
文件并编辑以下几行
$config['base_url'] = 'http://yourdomainhere.com.uk.alien.org';
$config['index_page'] = ''; //make this blank
修改强>
.htaccess文件必须是Unix LF样式。如果您使用记事本或写字板并以CR / LF样式上传.htaccess文件,则无法使用。