2012-09-08 75 views
0

當我嘗試刪除index.php 和訪問控制器:mysite.com/admin 我不斷收到內部服務器錯誤。 我不知道爲什麼它不起作用。使用htaccess無法刪除index.php

的.htaccess

<IfModule mod_rewrite.c> 
RewriteEngine On 
RewriteBase /code/ 

RewriteCond %{REQUEST_URI} ^system.* 
RewriteRule ^(.*)$ index.php?/$1 [L] 

RewriteCond %{REQUEST_URI} ^application.* 
RewriteRule ^(.*)$ index.php?/$1 [L] 

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ index.php?/$1 [L] 
</IfModule> 

站點配置

<Directory /home/mysite.com/public_html/> 
Options Indexes Includes FollowSymLinks MultiViews 
AllowOverride AuthConfig FileInfo 
Order allow,deny 
Allow from all 
</Directory> 

Apache的錯誤日誌

[Sat Sep 08 15:24:30 2012] [error] [client 176.106.162.240] 
Request exceeded the limit of 10 internal redirects 
due to probable configuration error. Use 'LimitInternalRecursion' 
to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace. 
+1

你看服務器錯誤日誌,看看到底是什麼,它說這個問題將造成500試用?你應該自己做一些基本的調試,它總是從查看日誌開始,而不是讓我們猜測問題。 –

回答

0

變化的.htaccess

<IfModule mod_rewrite.c> 
RewriteEngine On 
RewriteBase /code/ 

RewriteCond %{REQUEST_URI} ^system.* 
RewriteRule ^(.*)$ index.php?/$1 [L] 

RewriteCond %{REQUEST_URI} ^application.* 
RewriteRule ^(.*)$ index.php?/$1 [L] 

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ index.php?/$1 [L] 
</IfModule> 

進入這一個:

RewriteEngine On 

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ /index.php [L,NC] 

我不相信你有什麼事。

+0

Naw,同樣的事情+我添加了Apache錯誤日誌 – Reinis

+0

嘿,我有Index.php而不是index.php,你能幫我嗎? –

0

沒有仔細看它,我看到RewriteBase /code/

一個問題RewriteBase /

0
You just need to create .htaccess file in project folder and write: 

RewriteEngine On 

RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 

# Rewrite all other URLs to index.php/URL 
RewriteRule ^(.*)$ index.php?url=$1 [PT,L] 

</IfModule> 
<IfModule !mod_rewrite.c> 
    #ErrorDocument 404 index.php 
</IfModule> 

#And You don't need to define in base_url in config file: 

$config['base_url'] = '';// blank it. 

I hope it will work perfectly ...