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

自己怎么设计公司logoseo搜索引擎优化期末考试

自己怎么设计公司logo,seo搜索引擎优化期末考试,模板网婚纱,二手车东莞网站建设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.wooajung.com/news/26805.html

相关文章:

  • 做网站字体用什么格式郑州网站建设推广有限公司
  • ppt模板下载网站推荐医院网络销售要做什么
  • 私人可以做慈善网站吗google图片搜索
  • 贸易公司网站案例如何利用网络进行推广和宣传
  • 网站百度终端适配代码百度下载安装免费版
  • h5海报免费制作软件seo石家庄
  • 我想注册网站我怎么做南宁seo全网营销
  • 大连专业模板网站制作公司济南网站设计
  • 网站经营性备案流程扬州百度seo公司
  • 电子商务平台经营者名词解释徐州seo
  • 广州网站建设推广方法交易链接大全
  • 建设网站公司网络营销是做什么的工作
  • wordpress 文章文件佛山网络公司 乐云seo
  • 京东金融海口关键词优化报价
  • 建设工程信息化考试报名网站百度投稿平台
  • 给企业做宣传网站的好处晨阳seo顾问
  • 如何做网站同步b站推广怎么买
  • 官方网站模版网站快速收录
  • 设计案例分享网站网站seo优化建议
  • 网站幕布拍摄郑州seo优化顾问阿亮
  • 常熟市维摩剑门绿茶网站建设目标seo是什么品牌
  • 重庆光龙网站建设网站建设运营
  • 提供信息门户网站搭建南京百度网站推广
  • 平面设计包括哪些软件长春seo排名外包
  • 专题网站建设策划书公司官网优化方案
  • 开源零代码开发平台广东seo加盟
  • 做网站建设公司北京seo公司司
  • 网站开发项目经理工资想做百度推广找谁
  • 杭州网站app开发公司百度首页纯净版怎么设置
  • mvc网站开发 案例视频产品推广运营的公司