【问题标题】:CodeIgniter 3 removing index.php from url [duplicate]CodeIgniter 3 从 url 中删除 index.php [重复]
【发布时间】:2020-08-12 11:25:07
【问题描述】:

我所做的一切都完成了,但仍然无法正常工作。我不知道我怎么了。 我已经在我的 apache2 服务器上启用了mod_rewrite。在配置中,$config['index_page'] = ''; 和$config['uri_protocol'] = 'REQUEST_URI'; 这是我的基本网址$config['base_url'] = 'http://localhost/RB'; 我的 codeignitor 根 .htaccess 文件包含,

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

【问题讨论】:

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

标签: php codeigniter codeigniter-3


【解决方案1】:

这是他们官方website上给出的代码。

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

【讨论】:

  • 我试过了,但没有用。请告诉我其他的事情。
  • 嘿,尝试将 base_url 更改为此 → $config['base_url'] = 'http://localhost/rb/';
    注意尾部的斜杠 (/) 和小写字母,并将文件夹名称更改为小写。 (网址应始终为小写)
  • 我做到了,但还是不行。
猜你喜欢
  • 2015-09-28
  • 2021-12-15
  • 2016-11-23
  • 2022-01-06
  • 2016-05-14
  • 2014-10-28
  • 2012-06-15
  • 2012-09-21
相关资源
最近更新 更多