当前位置: 首页 > news >正文

wordpress 登陆不跳转人教版优化设计电子书

wordpress 登陆不跳转,人教版优化设计电子书,网站建设运营岗位职责,amaze ui做网站好吗Nginx 的 rewrite 指令用于根据正则表达式来匹配请求的 URI,并将其重写为新的 URI。rewrite 指令可以包含一个可选的 flag(标志),该标志用于控制重写操作后的行为。 rewrite regex replacement [flag] 一. 常用四种 flag redir…

Nginx 的 rewrite 指令用于根据正则表达式来匹配请求的 URI,并将其重写为新的 URI。rewrite 指令可以包含一个可选的 flag(标志),该标志用于控制重写操作后的行为。

rewrite regex replacement [flag]

一. 常用四种 flag

  1. redirect(302 临时重定向)
  • 当重写完成后,以临时重定向的方式返回重写后生成的新 URL给客户端,状态码为 302。
  • 浏览器地址栏会显示跳转后的 URL 地址。
  1. permanent(301 永久重定向)
  • 当重写完成后,以永久重定向的方式返回重写后生成的新 URL 给客户端,状态码为 301。
  • 浏览器地址栏会显示跳转后的 URL 地址。
  1. break
  • 重写完成后,停止对当前 URL 在当前 location 以及其他 location 中(当前 serve)后续的其它重写操作。
  • 不会跳出 location 作用域,也不会重新搜索与更改后的 URI 相匹配的 location。
  • 适用于一个 URL 一次重写的场景。
  1. last
  • 重写完成后,停止对当前 URI 在当前 location 中后续的其它重写操作。
  • 但会对新的 URL 启动新一轮重写检查,并可能跳出当前 location 作用域,搜索与更改后的 URI 相匹配的 location。
  • 适用于一个 URL 可能需要多次重写的场景。

二. last 和 break 区别

server {listen 80;server_name  pic.path-analytics.com;root /tmp/html/;location / {rewrite /1.html /2.html;rewrite /2.html /3.html;}location /2.html {rewrite /2.html /a.html;}location /3.html {rewrite /3.html /b.html;}
}
情况一:无 flag

访问 http://pic.path-analytics.com/1.html,结果为:

在这里插入图片描述
执行顺序如下:

  1. 首先匹配 location

    在这里插入图片描述

  2. 然后根据第一个 rewrite 将 URL 由 /1.html 改写为了 /2.html

  3. 此时并未重新发起请求,而是在当前 location 中查找是否有关于 /2.html 的 重写规则

  4. 查找到第二个 rewrite 将 URL 由 /2.html 改写成 /3.html,再去查找当前 locaiton 中是否还有 /3.html 的重写规则

  5. 没有找到,此时 URL 为 http://pic.path-analytics.com/3.html

  6. 再次去请求,匹配 location
    在这里插入图片描述

  7. 进入该 location,将 URL 由 /3.html 改写为 /b.html。这个 location 中没有 /b.html 的改写规则,此时 URL 为 http://pic.path-analytics.com/b.html

  8. 再次去请求,匹配 location
    在这里插入图片描述

  9. 但是该 location 中没有 /b.html 的匹配规则,所以直接响应 b.html

情况二:break
location / {rewrite /1.html /2.html  break;rewrite /2.html /3.html;
}

访问 http://pic.path-analytics.com/1.html,结果为:

在这里插入图片描述

执行顺序如下:

  1. 首先匹配 location
    在这里插入图片描述
  2. 执行第一个 rewrite 将 URL 由 /1.html 改写为 /2.html
  3. break 直接终止了当前 location 和其他 location 的匹配,返回 2.html
情况三:last
location / {rewrite /1.html /2.html  last;rewrite /2.html /3.html;
}

访问 http://pic.path-analytics.com/1.html,结果为:
在这里插入图片描述
执行顺序如下:

  1. 首先匹配 location
    在这里插入图片描述
  2. 执行第一个 rewrite 将 URL 由 /1.html 改写为 /2.html
  3. last 终止了当前 location 中的匹配,此时 URL 为 http://pic.path-analytics.com/2.html
  4. 再次去请求,匹配 location
    在这里插入图片描述
  5. 根据 rewrite 将 URL 由 /2.html 改写为 /a.html,此时 URL 为 http://pic.path-analytics.com/a.html
  6. 再次去请求,匹配 location
    在这里插入图片描述
  7. 该 location 中没有 /a.html 的匹配规则,所以直接响应 a.html
情况四:修改 location 优先级

在 location 中使用正则匹配

location ~ / {rewrite /1.html /2.html  last;rewrite /2.html /3.html;
}

访问 http://pic.path-analytics.com/1.html,结果为:

在这里插入图片描述
执行顺序如下:

  1. 首先去匹配 location
    在这里插入图片描述
  2. 根据第一个 rewrite 将 URL 由 /1.html 改写为 /2.html
  3. last 终止了当前 location 中的匹配,此时 URL 为 http://pic.path-analytics.com/2.html
  4. 再次去请求,由于 location 中正则匹配的优先级高于普通匹配,匹配 location
    在这里插入图片描述
  5. 在该 location 中,根据 rewrite 将 URL 由 /2.html 改写为 /3.html,此时 URL 为 http://pic.path-analytics.com/3.html
  6. 再次去请求,由于 location 中正则匹配的优先级高于普通匹配,匹配 location
    在这里插入图片描述
  7. 在该 location 中没有找到 /3.html 的重写规则,所以直接响应 3.html

三. 不同 flag 下浏览器与网络请求的不同表现

location / {rewrite /1.html /2.html [flag];rewrite /2.html /3.html;
}location /2.html {rewrite /2.html /a.html;
}
情况一:没有 flag

在这里插入图片描述

情况二:break

在这里插入图片描述

情况三:last

在这里插入图片描述

情况四:redirect

在这里插入图片描述

情况五:permanent

在这里插入图片描述

http://www.ds6.com.cn/news/75785.html

相关文章:

  • 网站推广花费多少钱sem投放
  • 湖南微信网站天津seo数据监控
  • 做局域网网站新品牌推广方案
  • 美剧网站怎么做基本seo
  • 制作网站开发项目的方案书怎样在百度上发表文章
  • 做网站如何自动采集图片线上如何做推广
  • 电商网站开发面试题网站自动推广软件
  • 有哪些网站免费学习建设网站的qq推广软件
  • 抖音里做我女朋友网站产品网络推广深圳
  • 佛山高明疫情最新消息seo快速优化报价
  • 客户关系管理系统流程图新站整站优化
  • 深圳开发公司网站如何免费推广自己的产品
  • jsp做的个人网站天津网络推广seo
  • 百度网站公司信息推广怎么做凡科建站手机版登录
  • 怎么做网上卖菜网站优化方案的格式及范文
  • 织梦cms wordpress廊坊seo推广
  • 怎样优化网站 优帮云seo整站怎么优化
  • 北京建网站开发要怎么做网络推广
  • 手机网站asp个人博客网页制作
  • 承德网站建设费用十大外贸电商平台
  • 做行业网站赚钱吗国内seo排名
  • 北京朝阳区天气预报黑龙seo网站优化
  • 国外做连接器平台网站在哪里可以发布自己的广告
  • 英文网站建设980北京疫情最新数据
  • php如何做动态网站国内免费b2b网站大全
  • 北京欢迎你 网站建设seo怎么读
  • 电商网站储值消费系统国际新闻最新消息
  • 建官方网站的公司怎样无货源开网店
  • 做牛津布面料在哪个网站找客户企业课程培训
  • 如何做介绍一门课程的网站百度竞价排名规则及费用