2014-02-27 23:31 阅读 32


Im looking to remove the .php on the end of my app's webpage but im not quite sure how to do so in my app.yaml

heres an example:

application: MY APP
version: 1
runtime: php
api_version: 1
threadsafe: yes


- url: /
 script: index.php

- url: /index.php
 script: index.php 

But when I open up my app on my web browser, it says

how can I get rid of the .php?


  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

1条回答 默认 最新

  • 已采纳
    dongyuan6949 dongyuan6949 2014-02-28 00:44

    The app.yaml file will not result in the URL being re-written in the browser. You can write your app.yaml file to not require the php suffix on URLs

    - url: /
     script: index.php
    - url: /index
     script: index.php 
    - url: /foo
      script: bar.php

    Now the url /index will invoke the script index.php, /foo will invoke bar.php etc.

    If you want this sort of addressing for all of your php scripts then you could do something like

    - url: /(.+)
      script: (\1).php

    Now the URL /foo would call the script foo.php, /bar would call the script bar.php etc.

    点赞 评论 复制链接分享