首页 > 编程知识 正文

网址重定向,nginx修改重定向地址

时间:2023-05-03 23:02:48 阅读:115896 作者:2751

站点的域名已升级。 必须启用新域名的使用。

但是,用户不知道,也可能使用旧域名访问网站。

必须将使用旧域名访问的源重定向到新域名。

语法:

#将当前域名的所有请求重定向至新域名www.lnmp.com rewrite/http://www.lnmp.com permanent #将重定向至301永久重定向,然后浏览器的浏览器

#shop.lnmp.com的要求均为www.lnmp.com的server { listen 80; server_name shop.lnmp.com; rewrite/http://www.lnmp.com permanent; - * * * }服务器{ listen 80; #绑定新域名即可访问server_name www.lnmp.com; --* * *根html/TP5shop/public; 索引索引. PHP索引. html; access _ loglogs/shop.lnmp.com _ access.log mylogs; 位置/{ rewrite/index.html/index.PHP last; } location~. PHP $ { fastcgi _ pass 127.0.0.133609000; fastcgi_index index.php; fastcgi _ param script _ filename $ document _ root $ fastcgi _ script _ name; 包括fastcgi _ params; }

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。