PHP CI框架的url路由配置
来源:互联网 发布:手机淘宝详情店铺活动 编辑:程序博客网 时间:2024/05/17 06:50
现在使用的nginx,这里以版本为1.10.3的nginx为例,现在增加了try_files语法,比原来的rewrite路由的方式更加高效。
CI框架使用MVC框架,框架需要单一入口来处理请求,对于不存在的文件要做一下重新路由的功能,这是必需的。
为了支持CodeIgniter框架, linux的 nginx 增加了一项配置,如下:
server { listen 8000 default_server; server_name newcar.site; root /var/www/newcar; index index.php index.html index.htm; location / { try_files $uri $uri/ /index.php; } location ~ \.php$ { include snippets/fastcgi-php.conf; include fastcgi_params; fastcgi_pass unix:/var/run/php/php7.0-fpm.sock; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_split_path_info ^(.+\.php)(.*)$; fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info; } }
其中标黄的部分表示的意思其实就是rewrite机制,如果请求的文件不存在而且文件夹也不存在时,才会跳转到/index.php页面
Windows下nginx的配置:
server { listen 80; server_name newcar.xin.com ; root "D:/phpStudy/WWW/x.xin.com";index index.html index.htm index.php; location / { try_files $uri $uri/ /index.php; } location ~ \.php(.*)$ {include uxin-conf.d/www_newcar.conf; include fastcgi_params; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_split_path_info ^((?U).+\.php)(/?.+)$; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param PATH_INFO $fastcgi_path_info; fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info; }}
阅读全文
0 0
- PHP CI框架的url路由配置
- URL路由设置-CI(codeigniter)PHP框架再探
- ci框架中的url路由规则
- PHP CI框架配置
- CI框架路由去掉index.php
- CI框架 .htaccess 隐藏url中index.php的解决
- php ci框架之配置
- nginx 配置 php 的 CI 框架的web
- PHP CI框架的安装配置和简单使用
- 去掉php框架CI默认url中的index.php
- 去掉php框架CI默认url中的index.php
- CI框架 .htaccess 隐藏url中index.php的解决(转)
- CI 框架去除URL上的index.php 来直接访问
- CI框架如何删除URL中index.php的终极解决方案
- URL带有其他参数时,如何使用PHP的CI框架分页类?
- CI框架如何删除URL中index.php的终极解决方案
- 有效删除CI框架中URL中的index.php
- CI框架去掉URl中的index.php部分
- PPT神技能,如何使用PPT制作炫酷视频?我想你还是不会吧!
- codevs 2622 数字序列 DP 解题报告
- linux 8-9
- mysql解压版安装
- C++ 引用与指针
- PHP CI框架的url路由配置
- Django之ModelForm组件
- ssd准备自己的数据集进行训练遇见错误和解决方法
- BZOJ4537 [Hnoi2016]最小公倍数 分块+可撤销并查集
- 编写目标跟踪程序时出现Tracher未定义的错误-->opencv_contrib编译(Windows)
- 线性表简介
- Python的join函数
- Android 谷歌推荐的VR实现方式
- TP5 获取数据集记录数