如何从codeigniter URL中删除index.php

时间:2011-06-01 12:50:26

标签: codeigniter

  

可能重复:
  how to remove index.php from url in codeigniter ?

我想从codeigniter网址中删除index.php。我创建了.htaccess文件并在其上放置了以下代码(在CodeIgniter网站上找到。但是我无法访问localhost上的任何内容。如果我将代码放在.htaccess文件中,我会收到错误“Not Found”。

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

我的网址看起来像localhost/test/project/index.php

3 个答案:

答案 0 :(得分:1)

你是否删除了index.php

$config['index_page'] = '';

来自应用程序的配置文件夹中的配置文件?

答案 1 :(得分:0)

Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*)$ index.php

答案 2 :(得分:0)

如果您已尝试过用户指南中的所有内容并且没有运气,那么您的本地设置可能会出现问题。如果您使用的是Mac,则可能是Apache设置存在问题。我会检查/etc/apache2/[username].conf并确保您AllowOverride设置为All

相关问题