dsnm64969
2018-06-08 20:44
浏览 71
已采纳

使用一些php文件在GAE上托管一个大多数静态的网站

I'm hosting a mostly static website on the Google App Engine and have some trouble with setting up my app.yaml it seems. It's either that or my filepath is off. I have seen other posts where mixing static and dynamic content seems to give some trouble so I have decided to set up my files as such:

Site (Root Folder)
    app.yaml
    contact (Dynamic page)
        -index.php
    projects (Nothing in here yet but will group dynamic content here)
    README.md
    www (Static files)
        -blog
        -css
        -images
        -index.html
        -js

Trying to create link on my homepage which is

/www/index.html

to my contact page which is

/contact/index.php

My filepath that should direct you from index.html to index.php is

../contact/index.php

and below is my app.yaml

runtime: php55
api_version: 1

handlers:
    - url: /
      static_files: www/index.html
      upload: www/index.html
      mime_type: home
      secure: always

    - url: /(.*)
      static_files: www/\1
      upload: www/(.*)
      secure: always
      application_readable: true

    - url: contact/index.php
      script: /contact/index.php
      secure: always

Not sure what I'm doing wrong here. I've tried several different file paths but haven't been able to get the page to show up at all. When I click on the link that is supposed to take my to contacts page (index.php), I get a 404 error.

图片转代码服务由CSDN问答提供 功能建议

我在Google App Engine上托管一个大多数静态网站,但在设置app.yaml时遇到一些麻烦 它似乎。 它或者我的文件路径是关闭的。 我看过其他帖子混合静态和动态内容似乎给出了一些麻烦所以我决定设置我的文件:

  Site(Root Folder)
 app  .yaml 
联系人(动态页面)
 -index.php 
 projects(此处没有任何内容,但会在此处对动态内容进行分组)
 README.md 
 www(静态文件)
 -blog 
 -css  
 -images 
 -index.html 
 -js 
   
 
 

尝试在我的主页上创建链接

  /www/index.html
   
 
 

到我的联系页面

  / contact /  index.php 
   
 
 

我应该将你从index.html引导到index.php的文件路径是

 。  ./contact/index.php
nn

以下是我的app.yaml

 运行时:php55 
api_version  :1 
 
handlers:
  -  url:/ 
 static_files:www / index.html 
 upload:www / index.html 
 mime_type:home 
 secure:always 
 
  -  url:/(  。*)
  static_files:www / \ 1 
上传:www /(。*)
 secure:always 
 application_readable:true 
 
  -  url:contact / index.php 
 script:/contact/index.php\ 安全:总是
   
 
 

不确定我在这里做错了什么。 我尝试了几种不同的文件路径,但根本无法显示页面。 当我点击应该将我带到联系人页面的链接(index.php)时,我收到404错误。

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • du1843 2018-06-08 22:28
    已采纳

    Your wildcard catch-all handler is grabbing contact/index.php before it can get to its proper handler. Plus, you are missing the leading slash. mimetype: home is improper. Try this:

    runtime: php55
    api_version: 1
    
    handlers:
    - url: /contact/index.php
      script: /contact/index.php
      secure: always
    
    - url: /
      static_files: www/index.html
      upload: www/index.html
      secure: always
    
    - url: /(.*)
      static_files: www/\1
      upload: www/(.*)
      secure: always
      application_readable: true
    
    评论
    解决 无用
    打赏 举报

相关推荐 更多相似问题