简体   繁体   中英

Subfolders in gcloud app engine?

Basically I want to use my app engine PHP project on my website. It works when I put one file in my main folder but I want to use subdirectories on my website. For example, if I want a forums I would make the url https://example.com/forums/whatever.php . Instead, I make subdirectories inside my main folder and when I access the directory listed above, it just gives me a 404 not found (nginx) error.

Here is my app.yaml file:

runtime: php55
api_version: 1

handlers:
- url: /index
  static_dir: index

- url: /static
  static_dir: static

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

The reason for the 404 is that you don't have an app.yaml handler with a pattern matching the /forums/whatever.php path. You need to add one.

I'd recommend changing the one you have now for the home.php script with the generic pattern covering any php script path from the app.yaml Example :

 # Serve php scripts. - url: /(.+\\.php)$ script: \\1 

If you also want to have a default handler for an empty path you need to add it separately:

- url: /
  script: index.php

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