简体   繁体   English

无法将“找不到页面”重定向到404.php(gae php yaml)

[英]Unable to redirect Not Found Page to 404.php (gae php yaml)

I have the following error when I run WEBSITE/images/weq, i think it should be caught and redirect to 404.php, but it does not work, please help !! 当我运行WEBSITE / images / weq时,出现以下错误,我认为它应该被捕获并重定向到404.php,但它不起作用,请帮忙!

Error: Not Found The requested URL /images/weq was not found on this server. 错误:找不到在此服务器上找不到请求的URL / images / weq。

application: smile-bee-999
version: 1
runtime: php55
api_version: 1

default_expiration: "3d"

handlers:

- url: /
  script: index.php

- url: /favicon.ico
  static_files: favicon.ico
  upload: favicon.ico

- url: /sitemap.xml
  static_files: sitemap.xml
  upload: sitemap.xml  

- url: /robots.txt
  static_files: robots.txt
  upload: robots.txt  

- url: /images
  static_dir: images

- url: /css
  mime_type: text/css
  static_dir: css

- url: /font
  mime_type: text/font
  static_dir: font

- url: /font-awesome/css
  mime_type: text/css
  static_dir: font-awesome/css  

- url: /js
  mime_type: text/javascript
  static_dir: js

- url: /index.php
  script: index.php

- url: /about.php
  script: about.php

- url: /product.php
  script: product.php

- url: /contact.php
  script: contact.php

- url: /.*
  script: 404.php

Your question isn't really clear, I guess your 404 error handler is working for your handlers except the one with a static_dir ? 您的问题还不清楚,我想您的404错误处理程序对您的处理程序有效,但带有static_dir的处理程序除外?

If YES : I don't think you can make this work with static_dir because file served as static are served without any handler configuration. 如果是 :我认为您不能使用static_dir来完成此工作,因为作为静态文件提供的文件没有任何处理程序配置。 Therefore you cannot specify your own 404 handler. 因此,您不能指定自己的404处理程序。

If NO : Take a look at https://cloud.google.com/appengine/docs/php/config/appconfig#PHP_app_yaml_Custom_error_responses 如果否 :请查看https://cloud.google.com/appengine/docs/php/config/appconfig#PHP_app_yaml_Custom_error_responses

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM