404 error in google app engine with PHP Yii2 framework

google-app-enginegoogle-cloud-platform

My application contain Angular and Php Yii2 framework.

I hosted my application on to the app engine of the google cloud platform.

Here is the screenshot of my code and app.yaml file code.

threadsafe: true
runtime: php55
api_version: 2

handlers:

# The root URL (/) is handled by the Go application.
# No other URLs match this pattern.

- url: /(.+)
  static_files: \1
  upload: (.*)

- url: /web-service/*
  script: web-service/yii

- url: /
  static_files: index.html
  upload: index.html

enter image description here

My Yii2 library are available in web-service direcotry , when i call rest api from the postman then it is return 404 page not found error.

what thing i am missing into the app.yaml file.

Help me to solve this issue.

My Api is call something like this.

https://abcxyz.appspot.com/web-service/web/user-registration/login-user

Best Answer

The order of your URL handlers is not correct.

GAE does these top to bottom. Your first handler will match everything. It will never reach the other two.

You'll need to change the order in your app.yaml:

threadsafe: true
runtime: php55
api_version: 2

handlers:

# The root URL (/) is handled by the Go application.
# No other URLs match this pattern.

- url: /
  static_files: index.html
  upload: index.html

- url: /web-service/*
  script: web-service/yii

- url: /(.+)
  static_files: \1
  upload: (.*)

Suggested is to always have the broadest on the bottom, and the strictest on top.

See the section for it in the GAE app.yaml documentation.

Related Topic