简体   繁体   中英

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 !!

Error: Not Found The requested URL /images/weq was not found on this server.

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 ?

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. Therefore you cannot specify your own 404 handler.

If NO : Take a look at https://cloud.google.com/appengine/docs/php/config/appconfig#PHP_app_yaml_Custom_error_responses

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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