2

我在 ubuntu 12.10 上使用 apache2。但 htaccess 不工作,这是我的 htaccess 文件:

<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteBase /ci/
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ /index.php/$1 [L]
</IfModule>
<IfModule mod_security.c>
   SecFilterEngine Off
   SecFilterScanPOST Off
</IfModule>


$config['base_url'] = 'http://localhost/ci/index.php'; 
$config[‘index_page’] = “”;
$config[‘uri_protocol’]  = “AUTO”;


1 http://localhost/ci/index.php/site/about
2 http://localhost/ci/site/about

第一个工作,但我希望第二个工作任何想法如何使它工作。谢谢

404 Not Found
The requested URL /ci/site/about was not found on this server.
4

2 回答 2

0

你启用了mod重写吗?

设置您的 htaccess(示例)

<IfModule mod_rewrite.c>
  RewriteEngine On
  #RewriteBase /

  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteRule ^ index.php [QSA,L]
</IfModule>

在您的配置中删除 index.php

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

还允许在您的 apache 中覆盖 htaccess

/etc/apache2/sites-available/default

并编辑文件并更改为

AllowOverride All

并重新启动apache

于 2013-04-11T03:24:44.317 回答
0

这是我的设置的样子,我的工作就像你喜欢的那样工作:

.htaccess

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

配置文件

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

我认为这就是我所做的所有改变以使我的工作。

希望能帮助到你。

问候,

科布斯

于 2013-04-11T14:38:27.900 回答