thinkphp 关于url重写的问题

iis 环境(https://www.cnblogs.com/xunzhiyou/p/7758161.html)

1. URL重写组件url-rewrite2

微软官方下载地址

http://www.iis.net/downloads/microsoft/url-rewrite

下载安装

导入.htaccess 文件   点击应用

Apache 环境

httpd.conf文件。打开后找到DirectoryIndex

将默认的index.html文件改为index.php文件(任意自己想设置的入口文件)

找到mod_rewrite.so  去掉当前行注释,加载重写模式

2.将所有AllowOverride 后的默认设置None改为:All

并且在ThinkPHP文件config文件中配置重写模式为2:

    //rewriter重写模式
    'URL_MODEL'=>2,

原文地址:https://www.cnblogs.com/tianbo16/p/9453464.html