Nginx系统配置server 块内容-404网页重定向

时间:2023-07-29 14:19:25   阅读:336

通过修改配置文件,实现404错误页面重定向到首页或者指定网址:

Nginx系统配置server 块内容-404网页重定向

error_page 404 = @redirect_to_home;
    location @redirect_to_home {
    add_header Cache-Control "no-cache, no-store, must-revalidate";
    add_header Pragma "no-cache";
    add_header Expires "0";
    return 301 https://改为你的网址;
}

通过以上配置,当搜索引擎爬虫访问网站上的404页面时,Nginx 服务器将自动将其重定向到指定网址

上一篇:日入50+的超级实战的小红书引流课(小红书引流课程)

下一篇:腾讯官网首页(卡盟24小时自动发卡平台)(腾讯卡盟网址)

网友评论