简体   繁体   中英

How to solve Google AppEngine PHP redirect loop (app.yaml issue)

I have so much trouble trying to find a way to migrate my php application/script to google's appengine. I think it all stems to app.yaml.

When I access localhost:9080 it goes to redirect look like the follow:

http://localhost:9080/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/index.php/admin/login

Whats the problem, how can I solve this ? I tried the examples like wordpress it all works but not much explaining goes to how app.yaml is derived. Especially, if we take a phpscript, how can we easily migrate to google appengine, a migration path guide/tutorial would be helpful.

anyway, here's my app.yaml

application: phptestapp
version: 1
runtime: php
api_version: 1
threadsafe: yes

handlers:
- url: /favicon\.ico
static_files: favicon.ico
upload: favicon\.ico

- url: /.*
  script: index.php

Here is the link to configuring script handlers in app.yaml - LMK what's not clear about this documentation.

Without knowing your app it's hard to know what your app.yaml should look like.

I am guessing you're script index.php is redirecting to a script at admin/index.php, but you don't have a handler for that so. Perhaps your app.yaml needs to be

handlers:
- url: /favicon\.ico
  static_files: favicon.ico
  upload: favicon\.ico

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

- url: /.*
  script: index.php

So that if you have any url that specifies an exact script file, it will execute that script - like I said I'm guessing what your app should do.

Fwiw I just ran into something similar, trying to get a test WordPress instance up and running on App Engine.

Visiting http://localhost:10080 eventually landed here — http://localhost:10080/wordpress/wp-admin/install.php — with the redirect loop error.

But going here directly — http://localhost:10080/wp-admin/install.php — worked fine.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM