Reputation: 580
I am a bit confused about how to set the app.yaml up in order to get my work done. Previously I had this same codeigniter application running elsewhere with /support
sub-directory serving a custom php support desk application. It had no issues. Good ol' apache served it without any issue.
Now I want the same thing to be working on GAE! This is my app.yaml
application: <NAME>
version: 1
runtime: php55
api_version: 1
threadsafe: yes
handlers:
- url: /assets
static_dir: assets
- url: /favicon\.ico
static_files: favicon.ico
upload: favicon\.ico
- url: /support/.*
script: index.php
- url: /.*
script: index.php
secure: always
Just to make sure that I get all the files routed correctly after someone provides me a solution. Here's the directory structure for the support desk (It's called hesk)-
I need a solution with wildcards so that /support
works flawlessly with the sub-folders & everything.. also need to define static files. as you can see they are scattered all over the place.. not at all convenient but that's how it is! am poor at regex. So please have mercy on me.
Update: I added updated the app.yaml a bit.. now all the php scripts from the support root & 1st level sub-directories work
- url: /support/(.*)/(.*)\.php$
script: support/\1/\2.php
- url: /support/(.*)\.php$
script: support/\1.php
But problem is there are a tons of sub-folders in this thing. see this snap below of the support/inc folder. how to handle that? do I have to manually put a url-script pair for all the possible number of sub-dir levels? This is so frustrating!
Upvotes: 1
Views: 657
Reputation: 11370
You are sending every call to - url: /support/.*
to index.php
. What you want is a regex to send to the proper script:
- url: /support/(.+).php
script: support/\1.php
NOTE: your app.yaml
and index.php
are located inside the support
directory. You will want app.yaml
at the root, or you won't be able to access files outside the support dir. Is support
the root of this application?
Remember: urls are relative to the app.yaml
file
For files at the root level, you would use:
- url: /(.+).php
script: \1.php
You will want to put your static files in a static directory, and use:
- url: /static
static_dir: static
and access the files using, e.g.: /static/hesk_javascript.js
UPDATE 2 To handle static files using regex:
- url: /support/(.*\.(ico|jpg|jpeg|png|gif|woff|ttf|otf|eot|svg))$
static_files: support/\1
upload: support/.*\.(ico|jpg|jpeg|png|gif|woff|ttf|otf|eot|svg)$
application_readable: true
Upvotes: 2
Reputation: 580
Solution : Thanks GAEfan.. I kinda mixed n matched from your ideas & finally these are the needed handlers. It's running perfectly now!
#for all the static files residing at support root or at any other level
- url: /support/(.*\.(htm$|css$|js$|ico$|jpg$|png$|gif$))$
static_files: support/\1
upload: support/.*\.(htm$|css$|js$|ico$|jpg$|png$|gif$)$
application_readable: true
#for all the php files running at support root or at any other level
- url: /support/(.+)\.php
script: support/\1.php
#for using index.php at support root or at any other level
- url: /support/(.*)
script: support/\1/index.php
P.S : the handler below can run index.php from any other level but not support root
- url: /support/(.+)
script: support/\1/index.php
Upvotes: 1