惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

GbyAI
GbyAI
J
Java Code Geeks
雷峰网
雷峰网
WordPress大学
WordPress大学
宝玉的分享
宝玉的分享
云风的 BLOG
云风的 BLOG
V
Visual Studio Blog
V
Vulnerabilities – Threatpost
S
Securelist
The Hacker News
The Hacker News
The Register - Security
The Register - Security
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Help Net Security
Help Net Security
G
Google Developers Blog
Hugging Face - Blog
Hugging Face - Blog
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
M
MIT News - Artificial intelligence
AI
AI
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
The GitHub Blog
The GitHub Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
Schneier on Security
Schneier on Security
N
Netflix TechBlog - Medium
T
The Blog of Author Tim Ferriss
Google DeepMind News
Google DeepMind News
Hacker News - Newest:
Hacker News - Newest: "LLM"
H
Hacker News: Front Page
博客园 - 司徒正美
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
B
Blog
Microsoft Azure Blog
Microsoft Azure Blog
大猫的无限游戏
大猫的无限游戏
Security Latest
Security Latest
Engineering at Meta
Engineering at Meta
N
News and Events Feed by Topic
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
酷 壳 – CoolShell
酷 壳 – CoolShell
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
T
Threat Research - Cisco Blogs
U
Unit 42
V
V2EX
V2EX - 技术
V2EX - 技术
L
LINUX DO - 最新话题
aimingoo的专栏
aimingoo的专栏
Microsoft Security Blog
Microsoft Security Blog
Recorded Future
Recorded Future
P
Privacy & Cybersecurity Law Blog
美团技术团队
小众软件
小众软件
F
Fortinet All Blogs

博客园 - guoadou

新的开始 《项目管理艺术》读书笔记 —— 决定做什么的常见不良决策一览 《项目管理艺术》读书笔记 —— 项目规划的三种观点 《IF》 - Joseph Rudyard Kipling 论信息系统的架构设计 【转】系统架构设计师考试大纲(2009) The Elements of Programming Style 导出MySQL数据库结构的PHP脚本 轻松面试 搞定技术奇才 Cyworld Values & Principles 通过创建SCHEMABINDING VIEW提高JOIN的速度 长的很像Cyworld的QQ [北京][赛我网]HTML高级工程师 - guoadou - 博客园 [招聘] 韩国企业招聘Java .NET 开发人员 utf8_to_unicode in PHP document.body.scrollTop总是零的原因 unicode_to_utf8 in PHP [新闻]Cyworld.com.cn开始公测 hex2bin in PHP
nginx error_page 404 用 php header 无法跳转
guoadou · 2009-06-26 · via 博客园 - guoadou

之前用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; 就好了

=。=