我需要将所有来自*.php!foo=bar
的请求重新映射到*.php?foo=bar
in Google App Eninge main.yaml
我试着:
- url: /(.*)php5!(.*)$
script: '1php5?'2
但是它只会导致错误。问题源于"?"。
即使是
script: '1php5?foo=bar
您将无法将!(.*)
部分重新映射到app.yaml
内部的查询字符串,因为应用引擎sdk将script:
参数视为include()
和include("somefile.php5?foo=bar");
的文件,只有在php文件名包含查询字符串时才有效。
你可以试试这样做:
应用程序。yaml将所有!
请求路由到一个php脚本
- url: /(.*)php5!(.*)$
script: router.php
router.php将!
转换为?
,然后进行301重定向
<?php
$url = implode('?', explode('!', $_SERVER['PATH_INFO'], 2));
// 301 Moved Permanently
header("Location: {$url}", true, 301);