2014-01-09 15 views
1

我想解散Baker Framwork Cloud Console,除非URL沒有被正確重定向,否則一切都很順利。Google AppEngine PHP URL沒有正確重定向(循環)

URL我需要:

http://bake-console.appspot.com/index.php/admin/ 

,但該URL被重定向(環路)是這樣的:

http://bake-console.appspot.com/index.php/admin/index.php/admin/index.php/admin/index.php/admin/index.php/admin/index.php/admin/index.php/admin/index.php/admin/index.php/admin/index.php/admin/index.php/admin/index.php/admin/index.php/admin/index.php/admin/index.php/admin/index.php/admin/index.php/admin/index.php/admin/index.php/admin/index.php/admin/login 

我的app.yaml:

application: bake-console 
version: 1 
runtime: php 
api_version: 1 

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

- url: /(.+) 
    script: index.php 

- url: /media 
    static_dir: media 

每一件事情是工作當地罰款。

我想我在做一些app.yaml重寫錯誤。

在此先感謝。

+1

您的第一個處理程序/.*將匹配所有內容,第二個處理程序將永遠不匹配,您可能需要將其移至最下方。 – IanGSY

+0

謝謝@IanGSY剛剛修復我會在這裏發佈答案:) – user3155632

回答

1

由於@IanGSY我只是理解了它,並固定起來

,這裏是我的app.yaml

application: bake-console 
version: 1 
runtime: php 
api_version: 1 

handlers: 
- url: /media/(.*\.(css$|js$|png$)) 
    static_files: media/\1 
    upload: media/(.*\.(css$|js$|png$)) 
    application_readable: true 

- url: /(.+)?/? 
    script: index.php 
    secure: always 

- url: /.* 
    script: index.php 

,甚至加入這段代碼中的AppEngine文檔

$path = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH); 

// Provide mod_rewrite like functionality. If a php file in the root directory 
// is explicitely requested then load the file, otherwise load index.php and 
// set get variable 'q' to $_SERVER['REQUEST_URI']. 
if (dirname($path) == '/' && pathinfo($path, PATHINFO_EXTENSION) == 'php') { 
    $file = pathinfo($path, PATHINFO_BASENAME); 
} 
else { 
    $file = 'index.php'; 
    // Provide mod_rewrite like functionality by using the path which excludes 
    // any other part of the request query (ie. ignores ?foo=bar). 
    $_GET['q'] = $path; 
} 
// Override the script name to simulate the behavior without wrapper.php. 
// Ensure that $_SERVER['SCRIPT_NAME'] always begins with a/to be consistent 
// with HTTP request and the value that is normally provided (not what GAE 
// currently provides). 
$_SERVER['SCRIPT_NAME'] = '/' . $file; 

// Redirect to controller only if controller is set in URL 
if(isset($_GET['q']) && $_GET['q'] != "//") { 
    header("Location /index.php/" . $_GET['q']); 
} 
發現

我認爲這適用於Google Appengine上的所有codeigniter應用。