【问题标题】:No input file specified - Codeigniter未指定输入文件 - Codeigniter
【发布时间】:2014-01-04 21:00:35
【问题描述】:

我是 Codeigniter 的新手,在上传我的网站时,默认控制器/视图显示正常。但是,当我尝试打开其他页面时,会出现以下错误

“未指定输入文件。”

。令我困惑的是,这在 localhost 中运行良好。

我在这个论坛上阅读过有关更改 htaccess 文件的信息,但我不知道要更改哪个 htaccess 文件以及如何更改。

请帮忙

提前致谢

【问题讨论】:

    标签: .htaccess codeigniter


    【解决方案1】:

    您更改根目录(系统、应用程序文件夹所在的位置)中的.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 文件,它将无法正常工作。

    【讨论】:

    • 谢谢,我试过了,还是出现同样的错误信息。我在 godaddy 托管...
    • 请看这个link
    • 好的...我在其他网络托管服务器上进行了测试,它工作正常...所以我想你对 go daddy 的问题是正确的
    猜你喜欢
    • 2017-07-24
    • 1970-01-01
    • 2011-07-10
    • 2014-02-06
    • 2011-09-01
    • 2013-01-11
    • 2013-04-08
    • 1970-01-01
    相关资源
    最近更新 更多