使用.htaccess删除网址中的index.php,但失败
我创建了.htaccess来删除URL中的index.php。注销后,我重定向( auth);但在网址中显示index.php,即 http://localhost/myhems/index.php/auth
I have created .htaccess to remove index.php in url. After logout I redirect('auth'); but in the url appear index.php i.e. http://localhost/myhems/index.php/auth
有人知道为什么吗?
我不是确保您正在使用哪种操作系统,但是如果您使用的是 linux
,请确保启用了 mod_rewrite
,然后按照以下步骤操作,这是最简单的 .htaccess
规则:
I'm not sure what operating system your are working on, but make sure mod_rewrite
is enabled if you are on linux
then follow these steps, here is the simplest .htaccess
rules:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php/$1 [L]
将此文件保存在 FCPATH
中,然后转到 config.php
在 application / config
下,并确保将 base_url
设置为: / p>
Save this file in your FCPATH
, then go to your config.php
under application/config
and make sure to set the base_url
in:
$config['base_url'] = 'http://localhost/myhems/';
并删除 index.php
中的值在:
$config['index_page'] = '';