BAE Website 配置 app.conf 实现单入口

         在Baidu Application Engin 中搭建网站时,如果要使用MVC框架,往往需要设置单入口。然而BAE的web服务程序(apache或者lighthttp)对用户是透明的。开发者不能通过修改配置文件,也不能通过修改.htaccess文件来实现单入口。但BAE在应用的根目录提供了app.conf这个配置文件,通过修改它可以实现重写、设置缓存时间的功能。

         下面的这个app.conf,将所有,除文本文件和图片、视频文件等所有请求,都重定向到index.php。

 

handlers:

  - expire : .jpg modify 10 years

  - expire : .swf modify 10 years

  - expire : .png modify 10 years

  - expire : .gif modify 10 years

  - expire : .JPG modify 10 years

  - expire : .ico modify 10 years

  - url : ^(.*\.js)$

    script : /$1

  - url : ^(.*\.css)$

    script : /$1

  - url : ^(.*\.jpg)$

    script : /$1

  - url : ^(.*\.gif)$

    script : /$1

  - url : ^(.*\.jpeg)$

    script : /$1

  - url : ^(.*\.png)$

    script : /$1

  - url : ^(.*\.bmp)$

    script : /$1

  - url : ^(.*\.swf)$

    script : /$1

  - url : ^(.*\.ico)$

    script : /$1

  - url : ^(.*\.JPG)$

    script : /$1

  - url : ^(.*\.txt)$

    script : /$1

  - url : ^(.*)$

    script : /index.php


来源: 作程的技术博客 http://it.zuocheng.net 《BAE Website 单入口配置 app.conf》


原文地址:https://www.cnblogs.com/javawebsoa/p/3071937.html