RewriteRule index.php/$1 什么意思

来源:互联网 发布:win10无法卸载软件 编辑:程序博客网 时间:2024/04/29 17:40

REWRITE模式

REWRITE模式是在PATHINFO模式的基础上添加了重写规则的支持,可以去掉URL地址里面的入口文件index.php,但是需要额外配置WEB服务器的重写规则。

如果是Apache则需要在入口文件的同级添加.htaccess文件,内容如下:

1
2
3
4
5
6
<IfModule mod_rewrite.c>
 RewriteEngine on
 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteRule ^(.*)$ index.php/$1 [QSA,PT,L]
</IfModule>

接下来,就可以用下面的URL地址访问了: http://localhost/home/user/login/var/value 

在简单点说就是访问网站的时候隐藏index.php

0 0
原创粉丝点击