VPS侦探论坛

 找回密码
 注册
查看: 4078|回复: 5

nginx如何pathinfo模式和普通模式同时存在

[复制链接]
发表于 2016-7-2 18:56:11 | 显示全部楼层 |阅读模式

求助,nginx配置中,如何让pathinfo模式和普通模式同时存在,pathinfo模式也可以访问,普通模式也可以访问
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
发表于 2016-7-2 19:48:10 | 显示全部楼层


你说的伪静态吗?
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
 楼主| 发表于 2016-7-2 19:56:38 | 显示全部楼层

回复 2# 的帖子


是啊,当前所有的路径都走了pathinfo,但是网站还有插件是普通url,所以现在普通的url打不开网站
include none.conf;
        #error_page   404   /404.html;
        rewrite ^/([0-9]+)$ /index.php/Show/index/roomnum/$1;
        rewrite ^/([0-9]+)/([0-9]+)$ /index.php/Show/index/roomnum/$1/qrid/$2;

        location ~ [^/].php(/|$)
        {
            # comment try_files $uri =404; to enable pathinfo
           #try_files $uri =404;
            fastcgi_pass  unix:/tmp/php-cgi.sock;
            fastcgi_index index.php;
            include fastcgi.conf;
            include pathinfo.conf;
        }

        location ~ .*.(gif|jpg|jpeg|png|bmp|swf)$
        {
            expires      30d;
        }

        location ~ .*.(js|css)?$
        {
            expires      12h;
        }
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
发表于 2016-7-3 09:08:17 | 显示全部楼层

回复 3# 的帖子




/index.php/Show/index/roomnum/$1 的形式就是pathinfo的

你再设置一个伪静态肯定就没法访问pathinfo的形式了

thinkphp之类的框架也都是伪静态或pathinfo选一
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
 楼主| 发表于 2016-7-3 17:09:40 | 显示全部楼层

回复 4# 的帖子


谢谢军哥百忙中的解答,已经可以了

军哥运维代购:http://shop63846532.taobao.com/

发表于 2016-12-14 21:55:37 | 显示全部楼层

回复 5# 的帖子


怎么解决的能告知下吗~
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|VPS侦探 ( 鲁ICP备16040043号-1 )

GMT+8, 2024-9-28 07:16 , Processed in 0.027487 second(s), 16 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表