乐呵呵网
  • 首页index
  • 电脑知识pc
  • 手机知识mobile
  • 软件教程soft
  • 编程技术code
  • 生活常识life
  • 常见问答answer
  • 美食之家cate
  • 健身养生keep
  • 吃喝玩乐happy
您的位置:首页常见问答文章内容

nginx正则匹配的问题

浏览:137日期:2022-06-29

问题描述

location / { index index.html index.htm index.php; rewrite ^/(.*)$ /index.php?/$1;}

配置文件的正则部分如上,但是诸如.css和.jpg结尾的文件也被rewrite了,请问怎么屏蔽

问题解答

回答1:

location / { if (!-e $request_filename){ rewrite ^(.*)$ /index.php?s=/$1 last; #rewrite模式 rewrite ^(.*)$ /index.php/$1 last; #pathinfo模式 任选其一 } }

上一条:url-rewrite - nginx 目录后面斜杠问题下一条:为什么passenger要把nginx 装在opt下
相关文章:
1. 为什么老师,你de button按钮处可以有两个ID是一样的id="loginbtn" 而不会报错啊2. 为什么矛那里的 <a href=" " 这地方为什么是空的呢 ??3. 为什么总是提示我说Template "movieTemplate" not found,我路径都引对了呀4. <tr valign="top"> 看不懂5. solaris基础和常用知识 (2)6. html5 - 有可以一次性把所有 css外部样式转为html标签内style=" "的方法吗?7. javascript - type="date"的默认值能改变为当天日期吗8. mysql 使用 join 还是 "," 进行多表查询???9. mysql - 使用hibernate连接数据库时,数据库版本过高不支持关键字"type" ;10. javascript - 关于input="file",重复选择同一文件时不触发change事件的问题
热门推荐
  • node.js - nodejs中如何跳过登陆页直接进入某个页面?
  • node.js - nodejs中如何跳过登陆页直接进入某个页面?
  • 1.objective-c - @property重写 setter 和 getter 方法
  • 2.nginx 如何配置自定义500页面
  • 3.老师,我感觉羽义化标签也可以加class不就行了吗?为什么不用他?
  • 4.solaris基础和常用知识 (2)
  • 5.为什么总是提示我说Template "movieTemplate" not found,我路径都引对了呀
  • 6.git - 替自己回答error CAfile: ssl/certs/ca-bundle.crt CApath: none
  • 7.为甚么不用Pycharm
  • 8.课件视频错误
  • 9.Nginx作为代理,图片无法显示
  • 10.新添加到页面的控件备莫名被删除

网公网安备:皖ICP备2020019022号-8 Copyright ¢ 2020-2025 Powered by V1.8 All Rights Reserved 技术支持:乐呵呵网

声明:本站所有资源以学习为主