2011-12-06 38 views
-1

我有我的本地測試服務器(XAMPP)正常工作的Codeigniter 2.1安裝,但是當我已將此項移動到我的網絡解決方案託管上的測試子域時,我無法獲取.htaccess刪除index.php。我曾嘗試重寫路徑爲「/ htdocs中/測試」和/測試,但我仍然得到以下錯誤:/mod_rewrite爲網絡解決方案上的Codeigniter

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, [no address given] and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.

<IfModule mod_rewrite.c> 
SetEnv APPLICATION_ENV development 
RewriteEngine On 
RewriteBase /test 

#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] 

#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 
#This last condition enables access to the images and css folders, and the robots.txt file 
#Submitted by Michael Radlmaier (mradlmaier) 
RewriteCond $1 !^(index\.php|images|robots\.txt|css) 
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> 

我的子域名被安置在/ htdocs目錄測試

謝謝!

+0

你用'RewriteBase /'嘗試過嗎? – stealthyninja

+0

你能從錯誤日誌中粘貼消息嗎? – Repox

回答

0

問題很可能與httpd.conf有關,如果您無法自行編輯此問題,則可以在外部聯繫主機支持部門進行操作。如果你能夠在你的主機上編輯你的Apache配置,你可以發佈它,我們可以幫助你。

該模塊被加載,但可能不允許您的目錄重寫,特別是不讓它跟隨符號鏈接,這是如何工作的。

0

首先,確保你的mod_rewrite模塊安裝在apache中。在主index.php文件頂部殺死腳本:

<?php die(var_dump(apache_get_modules())); ?> 

如果你沒有看到任何地方mod_rewrite它沒有安裝。

要安裝它,您的服務器上運行以下命令(如果你有機會),

sudo a2enmod rewrite 

這則啓用了mod_rewrite對我來說它工作得很好。

如果您沒有root訪問權限,您可能需要聯繫客戶支持,看看他們是否可以爲您啓用它。