首页 > 解决方案 > 我在 GAE 中托管我的网站(php 文件)。app.yaml 文件没有路由我网站的页面。错误:未找到

问题描述

我的网站有8个页面,它是用php编写的:https : //interculture.appspot.com 在GAE中部署后,它可以加载和显示index.php页面。但是,当我单击其他链接时,不显示其他页面:错误:未找到此服务器上未找到请求的 URL /file.php。

这是我的文件的目录:蓝色突出显示的是我网站的页面。 在此处输入图像描述

这是我的 app.yaml 文件:

runtime: php72 </b>

handlers:
# Serve a directory as a static resource.
- url: /styles
  static_dir: styles
  
# Serve images as static resources.
- url: /(.+\.(gif|png|jpg))$
  static_files: \1
  upload: .+\.(gif|png|jpg)$
  
# Serve your app through a front controller at index.php or public/index.php.
- url: /(.+\.php)$
  static_files: static/\1
  upload: /(.+\.php)$

# I add the "/" to url bellow as suggested but still get same error
- url: /.*
  script: auto
  secure: always

尽管它在浏览器中显示站点地址,但它显示:错误:未找到请求的 URL /file.php 在此服务器上未找到。

app.yaml 文件中缺少什么以正确路由到我网站的其他页面?

标签: google-app-enginephp-7.2web-site-projectapp.yaml

解决方案


您在 app.yaml 中的最终条目的 URL 应该是url: /.*(带斜杠)。这是匹配的 URL 所必需的https://intercultural.appspot.com/*您可以在app.yaml 参考中看到一个示例。


推荐阅读