VPS侦探论坛

 找回密码
 注册
查看: 4659|回复: 1

求一个nginx 404 跳转规则

[复制链接]
发表于 2012-7-28 17:06:59 | 显示全部楼层 |阅读模式

实现目标:
当用户访问 http://xxx.com/attachment/ 目录时,如果文件或目录 不存在(404),则跳转到 http://baidu.com/attachment/ 访问.

自己摸索是这样实现的.但是和伪静态有点冲突.请高手指点.

if (!-e $request_filename) {
                     rewrite ^/(.*)$ http://baidu.com/$1 permanent;
                }
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
发表于 2012-7-28 22:31:48 | 显示全部楼层


求解中。Nginx和Apache确实有点不一样
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|VPS侦探 ( 鲁ICP备16040043号-1 )

GMT+8, 2024-9-23 13:29 , Processed in 0.024463 second(s), 16 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表