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 乌班图ip地址配置及远程SSH
  • ¥15 怎么让点阵屏显示静态爱心,用keiluVision5写出让点阵屏显示静态爱心的代码,越快越好
  • ¥15 PSPICE制作一个加法器
  • ¥15 javaweb项目无法正常跳转
  • ¥15 VMBox虚拟机无法访问
  • ¥15 skd显示找不到头文件
  • ¥15 机器视觉中图片中长度与真实长度的关系
  • ¥15 fastreport table 怎么只让每页的最下面和最顶部有横线
  • ¥15 R语言卸载之后无法重装,显示电脑存在下载某些较大二进制文件行为,怎么办
  • ¥15 java 的protected权限 ,问题在注释里