2012-02-06 22 views
0

我剛剛完成我的網站,使用笨,我上傳的網站到BlueHost的帳戶作爲一個附加域.htaccess文件提出一個500錯誤頁面

我不使用QUERY_STRINGS,這裏是它在我的配置文件:

$config['enable_query_strings'] = FALSE; 

該網站將喲工作以及在我的測試服務器,但它上傳到我的BlueHost的帳戶,我想瀏覽任何網頁否則主頁

的時候遇到一些問題有另一個codeigniter網站loc的問題在主機的根目錄下有.htaccess文件以使其正常工作,所以當創建指向主域網站內的文件夾的新網站時,我認爲存在與我的插件網站的.htaccess相關的問題

這裏是我的插件網站

<IfModule mod_rewrite.c> 
RewriteEngine on 
RewriteBase /http://www.mydomain.com/ 

#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. 
    # Submitted by: ElliotHaughin 

    ErrorDocument 404 /index.php 
</IfModule> 
+1

評論了一次在一個線和一個導致500錯誤,那個重寫基地看起來也很腥,但是100%確定 – Eli 2012-02-06 01:20:11

+2

重寫基地'RewriteBase/http:// www.domain.com /' – 2012-02-06 01:21:40

+1

@宙斯的書:雅我以爲它使重定向困惑,可能無法訪問或內部循環? – Eli 2012-02-06 01:23:55

回答

0

感謝everybod,感謝禮你解決它,我加入了DirectoryIndex的,這裏是最後的.htaccess文件:

<IfModule mod_rewrite.c> 
RewriteEngine on 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond $1 !^(index\.php|images|img|css|js|robots\.txt) 
RewriteCond $1 !^(index\.php|application/views/|robots\.txt|install|favicon\.ico|documents) 
RewriteRule ^(.+)$ index.php?$1 [L] 
RewriteBase/
DirectoryIndex index.php 


#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. 
    # Submitted by: ElliotHaughin 

ErrorDocument 404 /index.php 
</IfModule> 
0

的.htaccess請參閱Apache doc on RewriteBase

的默認設置爲:RewriteBasephysical-directory-path

當對新URL進行替換時,該模塊必須將URL重新注入到服務器處理中。爲了能夠做到這一點,它需要知道相應的URL前綴或URL基礎是什麼。默認情況下,這個前綴是相應的文件路徑本身。但是,對於大多數網站來說,URL並不直接與物理文件名路徑相關,所以這種假設通常是錯誤的!因此,您可以使用RewriteBase指令來指定正確的URL前綴。

bluehost如何實現附加域?如果你可以使用一個控制面板指向http://www.mydomain.com/DOCROOT /插件,那麼這個.htaccess文件是DOCROOT/addon那麼在這種情況下應該是:

RewriteBase/

如果簡單地指向所有映射域DOCROOT(如那麼你需要使用%{HTTP_HOST}解碼和RewriteCond s,並且在如何做到這一點的相關Q中有很多例子,這需要在你的DOCROOT .htacces中有額外的調度行,例如

RewriteCond %{REQUEST_URI}  !^/addon/    [NC] 
RewriteCond %{HTTP_HOST}   =www.mydomain.com  [NC] 
RewriteRule ^(.*)    addon/$1     [L]