Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/google-app-engine/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Google app engine appengine部署站点上的内部链接不起作用_Google App Engine - Fatal编程技术网

Google app engine appengine部署站点上的内部链接不起作用

Google app engine appengine部署站点上的内部链接不起作用,google-app-engine,Google App Engine,我刚刚在谷歌Appengine上部署了一个测试网站。 使用GoogleAppEngineLauncher成功地完成了它 现在我试图打开部署的网站,请检查这里的内部页面没有打开 下面是我的应用程序YAML文件 application: acuteservice-1260 version: 1 runtime: php55 api_version: 1 threadsafe: yes handlers: - url: /(.*\.(gif|png|jpg|ico|js|css|eot|svg|tt

我刚刚在谷歌Appengine上部署了一个测试网站。 使用GoogleAppEngineLauncher成功地完成了它

现在我试图打开部署的网站,请检查这里的内部页面没有打开

下面是我的应用程序YAML文件

application: acuteservice-1260
version: 1
runtime: php55
api_version: 1
threadsafe: yes

handlers:
- url: /(.*\.(gif|png|jpg|ico|js|css|eot|svg|ttf|woff))
  static_files: \1
  upload: (.*\.(gif|png|jpg|ico|js|css|eot|svg|ttf|woff))

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

- url: .*
  script: index.php

这是因为您已指示应用程序引擎通过
index.php
路由所有操作(
*
)。您会意识到,当您导航到站点上的任何路径时,它会被重定向到
index.php

您可以做的是为站点中的所有其他页面添加更多url映射,这些映射应该在index.php映射之前

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

然后,您可以将所有url映射放到最后一个
index.php

如果这太麻烦了,并且有一堆php文件,您可以使用类似这样的东西来为所有php脚本提供服务:

application: acuteservice-1260
version: 1
runtime: php55
api_version: 1
threadsafe: yes

handlers:
- url: /(.*\.(gif|png|jpg|ico|js|css|eot|svg|ttf|woff))
  static_files: \1
  upload: (.*\.(gif|png|jpg|ico|js|css|eot|svg|ttf|woff))

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

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

- url: /.*
  script: index.php

请尝试下面的YAML,所有静态文件应转到“静态”文件夹


你说的内部页面没有打开是什么意思?是否有任何错误被抛出?没有错误一切正常,如果我点击about.php它仍然显示主页。添加了一行服务于所有php脚本,而不关心实际名称。看一看谢谢Jeffrey还有没有其他方法不添加“一网打尽”的功能?很抱歉不清楚。我指的是你正在使用的
*
。您可以专门将
/
映射到index.php,然后删除当前映射
*
。这样,当您导航到错误路径时,它将抛出404而不是显示索引脚本OK它不工作url“/index.php”与任何处理程序都不匹配。-url:/services script:services.php不工作url“index.php”将不匹配任何处理程序,如果您没有设置它,请执行此操作。要使它匹配,您必须编写一个处理程序来处理它。比如
-url:/index.php脚本:index.php
application: acuteservice-1260
version: 1
runtime: python
api_version: 1

default_expiration: "30d"

handlers:
- url: /(.*\.(appcache|manifest))
  mime_type: text/cache-manifest
  static_files: static/\1
  upload: static/(.*\.(appcache|manifest))
  expiration: "0m"

- url: /(.*\.atom)
  mime_type: application/atom+xml
  static_files: static/\1
  upload: static/(.*\.atom)
  expiration: "1h"

- url: /(.*\.crx)
  mime_type: application/x-chrome-extension
  static_files: static/\1
  upload: static/(.*\.crx)

- url: /(.*\.css)
  mime_type: text/css
  static_files: static/\1
  upload: static/(.*\.css)

- url: /(.*\.eot)
  mime_type: application/vnd.ms-fontobject
  static_files: static/\1
  upload: static/(.*\.eot)

- url: /(.*\.htc)
  mime_type: text/x-component
  static_files: static/\1
  upload: static/(.*\.htc)

- url: /(.*\.php)
  mime_type: text/html
  static_files: static/\1
  upload: static/(.*\.php)
  expiration: "1h"

- url: /(.*\.ico)
  mime_type: image/x-icon
  static_files: static/\1
  upload: static/(.*\.ico)
  expiration: "7d"

- url: /(.*\.js)
  mime_type: text/javascript
  static_files: static/\1
  upload: static/(.*\.js)

- url: /(.*\.json)
  mime_type: application/json
  static_files: static/\1
  upload: static/(.*\.json)
  expiration: "1h"

- url: /(.*\.m4v)
  mime_type: video/m4v
  static_files: static/\1
  upload: static/(.*\.m4v)

- url: /(.*\.mp4)
  mime_type: video/mp4
  static_files: static/\1
  upload: static/(.*\.mp4)

- url: /(.*\.(ogg|oga))
  mime_type: audio/ogg
  static_files: static/\1
  upload: static/(.*\.(ogg|oga))

- url: /(.*\.ogv)
  mime_type: video/ogg
  static_files: static/\1
  upload: static/(.*\.ogv)

- url: /(.*\.otf)
  mime_type: font/opentype
  static_files: static/\1
  upload: static/(.*\.otf)

- url: /(.*\.rss)
  mime_type: application/rss+xml
  static_files: static/\1
  upload: static/(.*\.rss)
  expiration: "1h"

- url: /(.*\.safariextz)
  mime_type: application/octet-stream
  static_files: static/\1
  upload: static/(.*\.safariextz)

- url: /(.*\.(svg|svgz))
  mime_type: images/svg+xml
  static_files: static/\1
  upload: static/(.*\.(svg|svgz))

- url: /(.*\.swf)
  mime_type: application/x-shockwave-flash
  static_files: static/\1
  upload: static/(.*\.swf)

- url: /(.*\.ttf)
  mime_type: font/truetype
  static_files: static/\1
  upload: static/(.*\.ttf)

- url: /(.*\.txt)
  mime_type: text/plain
  static_files: static/\1
  upload: static/(.*\.txt)

- url: /(.*\.unity3d)
  mime_type: application/vnd.unity
  static_files: static/\1
  upload: static/(.*\.unity3d)

- url: /(.*\.webm)
  mime_type: video/webm
  static_files: static/\1
  upload: static/(.*\.webm)

- url: /(.*\.webp)
  mime_type: image/webp
  static_files: static/\1
  upload: static/(.*\.webp)

- url: /(.*\.woff)
  mime_type: application/x-font-woff
  static_files: static/\1
  upload: static/(.*\.woff)

- url: /(.*\.xml)
  mime_type: application/xml
  static_files: static/\1
  upload: static/(.*\.xml)
  expiration: "1h"

- url: /(.*\.xpi)
  mime_type: application/x-xpinstall
  static_files: static/\1
  upload: static/(.*\.xpi)

# image files
- url: /(.*\.(bmp|gif|ico|jpeg|jpg|png))
  static_files: static/\1
  upload: static/(.*\.(bmp|gif|ico|jpeg|jpg|png))

# audio files
- url: /(.*\.(mid|midi|mp3|wav))
  static_files: static/\1
  upload: static/(.*\.(mid|midi|mp3|wav))  

# windows files
- url: /(.*\.(doc|exe|ppt|rtf|xls))
  static_files: static/\1
  upload: static/(.*\.(doc|exe|ppt|rtf|xls))

# compressed files
- url: /(.*\.(bz2|gz|rar|tar|tgz|zip))
  static_files: static/\1
  upload: static/(.*\.(bz2|gz|rar|tar|tgz|zip))

# index files
- url: /(.+)/
  static_files: static/\1/index.php
  upload: static/(.+)/index.php
  expiration: "15m"

- url: /(.+)
  static_files: static/\1/index.php
  upload: static/(.+)/index.php
  expiration: "15m"

# site root
- url: /
  static_files: static/index.php
  upload: static/index.php
  expiration: "15m"

- url: .*
  script: index.php