2011-03-05 92 views
3

林有一些麻煩,在我的CI去除index.php的東西安裝,使用當前的.htaccess IM如下:笨 - 刪除的index.php

<IfModule mod_rewrite.c> 
RewriteEngine On 
RewriteBase/

#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> 
ErrorDocument 404 /index.php 
</IfModule> 

我的CI安裝是從public_html目錄回我已經改變了config來

$config['index_page'] = ""; 

所以我的CI看起來像下面

/core-1.7.3 
/public_html/index.php 

w ^母雞我鍵入URL,我得到了404,但是當我在它前面放的index.php,它工作正常:S

林困惑

回答

0

也試圖改變這一點:

$config['uri_protocol'] = 「REQUEST_URI」 
+0

現在,它只是給404爲每個頁面的.htaccess重寫的FollowSymLinks指令......

Options Indexes FollowSymLinks <IfModule mod_rewrite.c> RewriteEngine On RewriteBase/ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php/$1 [L] </IfModule> 

Options指令是。 – Cecil 2011-03-05 11:56:53

+0

你能檢查這些東西嗎? 1.如果你的安裝不在服務器根目錄下,你將需要修改RewriteBase行從「RewriteBase /」到「RewriteBase/folder /」 2.確保你的apache使用mod_rewrite模塊 3.確保apache配置爲接受所需的.htaccess指令 [reference- http://codeigniter.com/wiki/mod_rewrite/] – 2011-03-05 12:12:25

0

嗨 我已經安裝了1.7.3,這與的.htaccess這個網址 -

/CodeIgniter_1.7.3/public_html/welcome 

.htaccess->

工作
RewriteEngine On 

RewriteCond $1 !^(index\.php|resources|robots\.txt) 

RewriteCond %{REQUEST_FILENAME} !-f 

RewriteCond %{REQUEST_FILENAME} !-d 

RewriteRule ^(.*)$ index.php/$1 [L,QSA]