簡體   English   中英

刪除CI ubuntu 12.04中的index.php文件

[英]remove index.php file in CI ubuntu 12.04

我想從CI中的文件路徑中刪除index.php文件。 我使用的是ubuntu 12.04。 我嘗試了幾乎所有的論壇結果,但沒有成功。

我將CI文件夾放在此路徑中。

http://localhost/xxx/CI/

我有apache重寫mod啟用。

sudo a2enmod rewrite
Module rewrite already enabled

我的conf.php文件中也有這個

$config['uri_protocol'] = 'AUTO';
$config['base_url'] = 'http://localhost/xxx/CI/'; 
$config['index_page'] = '';
$config['index_url'] = '';

我在.htaccess文件中有這個

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$0 [PT,L]

.htaccess文件就在這條路徑上

http://localhost/xxx/CI/.htaccess

它也可以通過apache啟用

/etc/apache2/sites-available/default
AllowOverride All

當我像這樣訪問文件時,我收到此錯誤

 http://localhost/xxx/CI/login/
 404 Error
 The requested URL /xxx/CI/login/ was not found on this server.

任何幫助將不勝感激 。

謝謝

嘗試使用下面的.htaccess文件:

RewriteEngine On
RewriteBase /xxx/CI/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php [L,QSA]

然后,將您的uri_protocolAUTO更改為PATH_INFO

$config['uri_protocol'] = 'PATH_INFO';

如果它開始將所有內容重新路由到默認控制器,則將其更改為ORIG_PATH_INFO

$config['uri_protocol'] = 'ORIG_PATH_INFO';

附加信息

將這些行插入您的文件:

Options -Multiviews +FollowSymLinks
AllowOverride All

試試以下:

RewriteEngine On
RewriteBase /xxx/CI/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /folder/index.php/$1 [L]

並且必須啟用apache的“rewrite_module”。

你的配置中的index_page應為空白$ config ['index_page'] ='';

你的htaccess文件中有這個代碼嗎?

RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM