使用.htaccess删除网址中的index.php,但失败 [英] Removing index.php in url using .htaccess but failed

查看:58
本文介绍了使用.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'] = '';

这篇关于使用.htaccess删除网址中的index.php,但失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆