2014-10-29 34 views
0

我知道這已被問了很多次,但我沒有找到答案,搜索了很多。所以我希望有人能幫助我。我有一個共享主機,並在public_html文件夾中,我希望安裝我的CI應用程序。子目錄名稱是「hrms」。Codeigniter 2共享託管子目錄安裝

所以我上傳了所有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> 
+0

您是否在index.php之前在htaccess中包含了您的目錄名... – CMPS 2014-10-29 13:22:14

+0

我猜不是。你能指點我一個很好的示例.htaccess將在我的情況下工作? – dotslash 2014-10-29 13:23:46

+0

你可以把你的hataccess代碼,所以我修改它 – CMPS 2014-10-29 13:25:05

回答

0

無事生非。

===== UPDATE =====

我現在發現,這個問題是與GoDaddy託管(GoDaddy的和CI有恨,恨的關係,看起來是)。訣竅是將你的index.php定義爲index.php? (注意問號)在config.php文件中。

儘管如此,非常感謝所有努力的人!

請注意:如果你的罰款與醜陋的網址,像http://www.example.com/index.php?/HomeController/myFunction並沒有使用路由(像我現在),是沒有必要的.htaccess文件。

+0

沒問題:)很高興我們可以/試圖幫助。 – PaulSkinner 2014-10-30 16:39:26

+0

真的,我爲所有的努力而感到謙卑。希望將來我會繼續得到這樣的支持。 :) – dotslash 2014-10-30 16:45:08

+0

沒問題。如果它是基於CodeIgniter的,我會永遠給它看看,如果你標記我:)(沒有承諾速度雖然...) – PaulSkinner 2014-11-05 11:29:12