【发布时间】:2017-06-01 07:40:49
【问题描述】:
我当前的网址如下所示:
http://www.example.com/testdesign/index.php/tasks
我需要它重定向到:
http://www.example.com/testdesign/tasks
我的 codeignitor 根 .htaccess 文件包含
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC]
RewriteCond %{REQUEST_URI} !/system/.* [NC]
RewriteRule (.?)index\.php/(.*) /$1$2 [R=301,NE,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
</IfModule>
我的 apache 服务器上启用了 mod_rewrite。
在我的配置文件中:
$config['index_page'] = '';
$config['uri_protocol'] = 'REQUEST_URI';
当我从 localhost 运行它时,它显示如下:
http://www.example.com/tasks
但我只想删除 index.php 而不是子域。
我知道这可能是一个很小的问题,但我找不到错误。
请你给我适当的建议吗?
我们将不胜感激任何形式的帮助。
提前致谢。
【问题讨论】:
-
@ShutUpMagda,我已经阅读了这份文件并申请了相同的文件,但没有工作。
-
我还注意到使用
site_url ()而不是base_url ()是导致此问题的原因之一。
标签: php apache .htaccess codeigniter mod-rewrite