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.

  • 写回答

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
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 下图接收小电路,谁知道原理
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探