douduo2407 2014-02-27 23:31
浏览 32
已采纳

删除文件扩展名谷歌应用程序引擎的PHP

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

handlers:

- url: /
 script: index.php

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

But when I open up my app on my web browser, it says http:www.example.com/mypage.php

how can I get rid of the .php?

Thanks

  • 写回答

1条回答 默认 最新

  • 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

    handlers:
    
    - 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.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 有没有帮写代码做实验仿真的
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog
  • ¥15 Excel发现不可读取的内容
  • ¥15 关于#stm32#的问题:CANOpen的PDO同步传输问题
  • ¥20 yolov5自定义Prune报错,如何解决?