2012-04-25 66 views
0

我是Apache環境的新手。我最好不要.htaccess文件,但我認爲我沒有選擇。我的應用程序在使用WAMPSERVER的Windows環境下的筆記本上運行時沒有問題。但是當我部署到使用Apache的託管服務器時,我遇到了一些問題。我不確定以下結構對於CodeIgniter應用程序是否正確。以下是託管服務器的目錄結構...子域中的多個CI應用程序

httodocs/ 
/survey 
    /admin 
      /config   <-- $route['default_controller'] = "admin"; 
      /controllers 
      /models 
      /views 
      /... 
    /statistic 
      /config   <-- $route['default_controller'] = "statistic"; 
      /controllers 
      /models 
      /views 
      /... 
    /mySurvey 
      /config   <-- $route['default_controller'] = "mySurvey"; 
      /controllers 
      /models 
      /views 
      /... 
    /css 
    /images 
    /scripts 
    /system 
    /... 
/index.php     <-- $application_folder = 'mySurvey'; 
/admin.php     <-- $application_folder = 'admin'; 
/Statistic.php    <-- $application_folder = 'statistic'; 

我所做的只是複製應用程序文件夾,並分別重新命名爲管理,統計和mySurvey,我設置的默認控制器如上所述。

所有的應用base_url() = 'http://survey.myhost.com'這是下myhost.com

根index.php文件實際上是CI應用環境允許時,他們輸入「http用戶在默認情況下,去mySurvey應用子域://調查.myhost.com」。

從第一頁,當我訪問http://survey.myhost.com/index.php/mySurvey/index/0 我得到錯誤:

`The specified CGI application misbehaved by not retruning a complete set of HTTP headers.` 

,當我訪問http://survey.myhost.com/admin.php/admin/loginhttp://survey.myhost.com/statistic.php?statistic/chart/1(請注意,我也確實使用查詢字符串我的應用程序)相同的消息顯示

顯然,這些都與路線有關。我在服務器上沒有任何.htaccess文件,因爲WAMP不需要它,請注意,如果有人能建議我在哪裏可以放置.htaccess文件,以及上述結構的正確模式重寫是什麼,並且此結構是否合適。

問候,

KK吉安

回答

0
root 
    /subs 
    /survey (survey.domain.tld) 
     /application (CI application folder) 
     /config 
     /models 
     ... 
     index.php (CI index.php file) 
    /statistics 
     /application (CI application folder) 
     /config 
     /models 
     ... 
     index.php (CI index.php file) 
    /mySurvey 
     /application (CI application folder) 
     /config 
     /models 
     ... 
     index.php (CI index.php file) 

    /system (CI system folder) 
index.php

(潛艇/調查/ index.php文件,潛艇/ mysurvey/idnex.php,潛艇/統計/ index.php的),你將鏈接在root/system/文件夾,以便

$system_path = '../../system'; 

現在你可以很容易地去survey.myhost.com,statistics.myhost.com等刪除的index.php,從URL字符串admin.php的($config['index_page'] = '';

希望我得到了你想要的東西

sorry for my english

+0

親愛@MireSVK,謝謝您的回覆和建議。您的建議是將每個應用程序放入不同的子域。這不是我想要的。基於我原來的想法,我只需要1個子域,即survey.myhost.com。統計和管理'模塊'在裏面。我希望你能理解我的問題。 – Gian 2012-04-26 01:27:47

+0

對不起,我會在稍後(今天)尋找一些解決方案。如果解決方案很好,我會在這裏發佈。現在,嘗試插入行'header('Content-type:text/html');'到index.php,staticists.php和admin.php的某處。通過FireBug(FF)或DragonFly(Opera)在HTTP標頭(響應)中尋找一些缺失的標題數據。 – miro 2012-04-26 05:50:47

相關問題