4.4.2 实例操作:基于参数匹配的跳转
(1)修改配置文件

文章插图

文章插图

文章插图
(2)浏览器访问测试

文章插图

文章插图
4.5基于目录下所有 php 结尾的文件跳转要求访问 http://www.fzr.com/upload/123.php 跳转到首页 。
4.5.1 基于目录下所有 php 结尾的文件跳转的操作步骤
vim /usr/local/nginx/conf/nginx.confserver { listen 80; server_name www.fzr.com; #域名修改 charset utf-8; access_log /var/log/nginx/www.fzr.com-access.log main; location ~* /upload/.*\.php$ { rewrite (.+) http://www.fzr.com permanent; } location / { root html; index index.html index.htm; }}systemctl restart nginx浏览器访问 http://www.fzr.com/upload/888.php 跳转到http://www.fzr.com页面 。4.5.2 实例操作:基于目录下所有 php 结尾的文件跳转
(1)修改配置文件

文章插图

文章插图

文章插图
(2)浏览器访问测试

文章插图

文章插图
4.6基于最普通一条 url 请求的跳转要求访问一个具体的页面如 http://www.fzr.com/abc/888.html 跳转到首页
4.6.1 基于最普通一条 url 请求的跳转的操作步骤
vim /usr/local/nginx/conf/nginx.confserver { listen 80; server_name www.fzr.com; #域名修改 charset utf-8; access_log /var/log/nginx/www.fzr.com-access.log; location ~* ^/abc/888.html { rewrite (.+) http://www.fzr.com permanent; } location / { root html; index index.html index.htm; }}systemctl restart nginx浏览器访问 http://www.fzr.com/abc/888.html 跳转到http://www.fzr.com页面 。4.6.2 实例操作:基于最普通一条 url 请求的跳转
(1)修改配置文件

文章插图

文章插图

文章插图
(2)浏览器访问测试

文章插图

文章插图
【rewrite与location Nginx重写功能】
推荐阅读
- C语言指针重点
- 第2-2-4章 常见组件与中台化-常用组件服务介绍-分布式ID-附Snowflake雪花算法的代码实现
- 【ASP.NET Core】MVC控制器的各种自定义:应用程序约定的接口与模型
- 文明与征服2022钓鱼达人活动图文攻略
- 剑与远征奇境探险海螺奇妙夜通关路线图攻略
- 闪耀暖暖归人与过客完美搭配套装选择攻略
- 2022蚂蚁庄园8月9日答案最新
- iQOOZ5与RealmeQ3s哪个好_iQOOZ5与RealmeQ3s选哪个
- 我的世界漏斗与漏斗之间怎么相连(我的世界漏斗上怎么放东西)
- 图学习【参考资料2】-知识补充与node2vec代码注解
