How to ignore directory of index.php in urlFor() link?

87 views Asked by At

I'm using gcloud's app engine with my index.php file in in a directory called '/public'. I set the app.yaml file's entry point to start there, so it treats that folder like the root directory in the url.

When I manually code the links on my site (href="home") everything works great (link shows as mysiteurl.com/home). When I use href="{{ urlFor('home') }}" the link shows as mysiteurl.com/public/home.

All the links work, and the site runs without error, but I don't want the /public showing up in the links or url. Is there a way to set an "entry point" (like in gcloud) for slim/twig so it treats /public as the root directory when generating links?

Update: This may actually be a gcloud issue. On localhost everything works as expected (using an .htaccess file that is ignored in .gcloudignore) but when I deploy the app the links become /public/page. Maybe app.yaml entry point is causing the issue?

Addtl Info: I'm using a standard environment and here is my app.yaml file:

runtime: php72

entrypoint: serve public/index.php

basic_scaling:
  max_instances: 1
  idle_timeout: 5m

handlers:
- url: /css
  static_dir: public/css
- url: /data
  static_dir: public/data
- url: /fonts
  static_dir: public/fonts
- url: /img
  static_dir: public/img
- url: /js
  static_dir: public/js
- url: /libs
  static_dir: public/libs
- url: /scss
  static_dir: public/scss

- url: /.*
  script: auto
  secure: always
0

There are 0 answers