Codeigniter 2共享托管子目录安装

时间:2014-10-29 13:13:05

标签: .htaccess codeigniter codeigniter-2

我知道之前已经问了很多次,但是我没有找到答案就进行了很多搜索。所以我希望有人会帮助我。我有一个共享主机,在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正在运行,因此我猜测所有配置都可以。

我做错了什么?此外,即使我打算通过完整的URL访问该网站,.htaccess文件也是必须的吗?

==== .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>

1 个答案:

答案 0 :(得分:0)

无所事事。

=====更新=====

我现在发现问题出在GoDaddy托管上(GoDaddy和CI有一种讨厌的关系,似乎)。诀窍是将index.php定义为index.php? (注意问号)在config.php文件中。

然而,非常感谢所有投入其中的人!

请注意:如果你对http://www.example.com/index.php?/HomeController/myFunction之类的丑陋网址不满意并且没有使用路由(就像我现在一样),则不需要.htaccess文件。