热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

yii+nginx制定美化url

安装完成yii后,配置好nginx。通过localhost:8212访问,正常.美化前访问接口:http:127.0.0.1:8212i

安装完成yii后,配置好nginx。通过localhost:8212访问,正常.

美化前访问接口:http://127.0.0.1:8212/index.php?r=word/get-word-details&aid=12

现在:http://localhost:8212/frontend/word/get-word-details&aid=12

1、将web下的index.php入口文件复制到项目最外层。比如:basic/web/index.php => basic/index.php

2、在basic/下新建重写规则nginx_rewrite.conf文件。

      内容为:rewrite ^/frontend/(.*)$  /?r=/$1&$query_string? last;

3、nginx配置文件增加重写规则:

      location / {

            index  index.html index.htm index.php;
            #系统用到的重写规则
            include  D:/project/basic/nginx_rewrite.conf;
        }

即可。


推荐阅读
author-avatar
问晓
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有