nginx error_page 404 用 php header 无法跳转
nginx error_page 404 用 php header 无法跳转
之前用Apache的时候,只需要设置
ErrorDocument 404 /404.php
就可以在 404.php 中根据不同的 REQUEST_URI 跳转到不同的页面去,让从搜索引擎过来的失效URL可以跳转到新的地址去
升级到 nginx 后的设置
error_page 404 /404.php;
结果发现确实执行了 404.php ,但自己设置的HTTP header无效,无论header怎么设置,永远是返回 404 Not Found.
临时解决方案:
在 rewrite rule 的最后增加
if (!-e $request_filename) {
rewrite ^(.*)$ /404.php last;
}
忽略 error_page 404
# 2009-07-09 update ----------------------------
nginx 没有问题,是我自己的问题
把 error_page 404 /404.php; 改成 error_page 404 = /404.php; 就好了
=。=
nginx error_page 404 用 php header 无法跳转的更多相关文章
- 为什么nginx error_page遇到后端错误时不跳转?
nginx不得不说的参数之 proxy_intercept_errors与fastcgi_intercept_errors 为什么我的error_page 配置没有生效,没有正常跳转?我也遇到过这个问 ...
- Nginx 自定义404、500错误页面跳转
自定义Nginx错误界面跳转 1.开启Nginx.conf配置文件下的自定义接口参数. http { fastcgi_intercept_errors on; } 2.在Server区域添加自定义的错 ...
- Nginx配置error_page 404错误页面
问题由来 昨天一网友在segmentfault.com上提问,无法做404重定向 打开对方的网站随便输入一个错误的地址发现给出了404代码,但是页面完全空白,并没有显示404页面的设定内容 当时就明白 ...
- [nginx]代理404跳转
1.nginx作为反向代理,如果代理请求的页面不存在,返回404,但是浏览器中一片空白. 要求:将404跳转到指定页面. 在server段添加: error_page 404 /; 不能生效,原因是需 ...
- nginx error_page
1. error_page语法 语法: error_page code [ code... ] [ = | =answer-code ] uri | @named_location 默认值: no 使 ...
- NGINX 配置404错误页面转向
什么是404页面 如果碰巧网站出了问题,或者用户试图访问一个并不存在的页面时,此时服务器会返回代码为404的错误信息,此时对应页面就是404页面.404页面的默认内容和具体的服务器有关.如果后台用的是 ...
- NGINX 配置404错误页面转向
什么是404页面 如果碰巧网站出了问题,或者用户试图访问一个并不存在的页面时,此时服务器会返回代码为404的错误信息,此时对应页面就是404页面.404页面的默认内容和具体的服务器有关.如果后台用的是 ...
- nginx 移动端和pc端自动跳转
场景 项 域名 描述 pc端 www.one.com 用于pc端访问官网 移动端 m.one.com 用于移动端访问 现在的需求是这样,在pc端访问www.one.com和m.one.com都跳转到w ...
- Ubuntu nginx 配置404错误页面
1.创建自己的404.html页面: 2.更改nginx.conf在http定义区域加入: /etc/nginx# vim nginx.conf 下添加 fastcgi_intercept_error ...
随机推荐
- Person
using System;using System.Collections.Generic;using System.Linq;using System.Text; namespace PersonD ...
- html form一点基础知识,实现文件上传
form用于提交文件需要修改其entype属性. enctype属性:规定在发送表单数据之前如何对其进行编码. 默认情况,enctype的编码格式是application/x-www-form-url ...
- C# Tips: Draw a data table in console
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.T ...
- fitsSystemWindow作用
fitsSystemWindows layout属性 英文文档注释为: Boolean internal attribute to adjust view layout based on system ...
- Git之基本命令
先介绍一下Git: Git是一个分布式的版本控制系统,最初由Linus Torvalds编写,用作Linux内核代码的管理.在推出后,Git在其它项目中也取得了很大成功,尤其是在Ruby社区中.目前, ...
- HTML+CSS学习笔记 (14) - 单位和值
标签:HTML+CSS 颜色值 在网页中的颜色设置是非常重要,有字体颜色(color).背景颜色(background-color).边框颜色(border)等,设置颜色的方法也有很多种: 1.英文命 ...
- webpShere中数据库集群url的设置
数据源配置的URL如下: jdbc:oracle:thin:@(DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 10 ...
- codevs 3185 队列练习1
题目描述 Description 给定一个队列(初始为空),只有两种操作入队和出队,现给出这些操作请输出最终的队头元素. 操作解释:1表示入队,2表示出队 输入描述 Input Description ...
- Css background缩写
例子: background:url(../images20130624/bg.png) no-repeat -1424px -5px; 官方API Value: ['background-color ...
- centos6.5下的mysql5.6.30安装
1.解压mysql tar -xf mysql-5.6.30-linux-glibc2.5-x86_64.tar.gz -C /usr/local mv mysql-5.6.30-linux-gli ...