2012-03-08 109 views
2

我已經嘗試了不少答案,但不斷提出反對好恐怖404牆。我在Windows 7上使用xamp堆棧。 mod_rewrite已啓用。從xign中的codeigniter刪除index.php

我把htaccess文件放在主「codeigniter」目錄下,即帶有application,system和user_guide的目錄。我應該把它放在應用程序目錄下嗎?有views/model/config/etc的那個?

這是我目前的.htaccess文件:

RewriteEngine On 

# Put your installation directory here: 
# If your URL is www.example.com/, use/
# If your URL is www.example.com/site_folder/, use /site_folder/ 

RewriteBase /website/codeigniter/ 

# Do not enable rewriting for files or directories that exist 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 

# For reuests that are not actual files or directories, 
# Rewrite to index.php/URL 
RewriteRule .* index.php/$0 [PT] 

訪問http://localhost/website/codeigniter/index.php/welcome工作 訪問http://localhost/website/codeigniter/welcome

我的config.php有

$config['base_url'] = 'http://localhost/website/codeigniter/'; 
$config['index_page'] = ''; 

任何幫助,不勝感激!

的錯誤是:

Object not found! 

The requested URL was not found on this server. If you entered the URL manually please check your spelling and try again. 

Error 404 

UPDATE 哦,就是想尋找在Apache日誌,收到此錯誤:

[Thu Mar 08 18:28:25 2012] [error] [client ::1] File does not exist: C:/xampp/htdocs/website/codeigniter/welcome 

所以它似乎不被拿起正確codeigniter重定向?不確定?

回答

0

試着改變你的htaccess的最後一行:

RewriteRule .* index.php/$1 [L] 
+0

剛剛試了一下,沒有變化 – Organiccat 2012-03-08 17:28:05

0

也可以嘗試改變你的請求方法在你的配置文件從AUTOREQUEST_URI

+0

試了一下,沒有變化 – Organiccat 2012-03-08 17:28:46

2

你在apache中啓用了mod_rewrite嗎?

+0

是,補充說,我有這個初步完成。 – Organiccat 2012-03-09 07:30:43

+0

爲什麼評論一個2歲的答案?我已經標記爲刪除 – 2014-06-03 19:05:17

4

首先創建.htacess文件並粘貼下面的代碼在 RewriteEngine敘述上

RewriteCond $1 !^(index\.php|resources|robots\.txt) 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ index.php/$1 [L,QSA] 

然後去配置文件

$config['index_page'] = 'index.php'; 

變化

$config['index_page'] = ''; 

,享受

3

試試這個:

RewriteEngine on 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteRule ^(.*)$ index.php/$1 [L] 
$config['index_page'] = 'index.php'; 

變化

$config['index_page'] = ''; 
0

首先PHP,使「改寫的Apache模塊」在XAMPP

如果您使用的XAMPP或WAMP包,那麼你會發現在該文件:

{xampp_dir}/apache/conf/httpd.conf 
{wamp_dir}/apache/conf/httpd.conf 

找到以下行並刪除'#'號。

LoadModule rewrite_module modules/mod_rewrite.so 

實際上,我們可以通過XAMPP彈出式菜單來完成:Apache - > Apache Modules - > rewrite module,並選擇它以啓用它。

其次,我們需要按照改變的htaccess:

RewriteEngine on 

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

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