Results 1 to 3 of 3

Thread: Separate environments for Frontend and Backend

  1. #1
    User
    Join Date
    11-16-11.
    Location
    Hamburg
    Posts
    39

    Default Separate environments for Frontend and Backend

    When developing for frontend locally, I used to access the frontend per app_dev.php, and backend as normal (in prod environment), because backend is significantly slower in dev environment.
    Is it possible to do it using .env file in C4.8? Backend in dev mode really slows the work down...

  2. #2
    User
    Join Date
    11-16-11.
    Location
    Hamburg
    Posts
    39

    Default

    Ok, I dig little bit into the code, it looks like ContaoKernel checks the $_SERVER['APP_ENV'] variable, before reading it from the .env file, so I had the idea to set the APP_ENV to 'prod', if the URI_STRING begins with contao/, but I can't get it to work. May be someone can help with this?

    I'm using this in my .htaccess:
    Code:
    RewriteRule ^contao - [E=APP_ENV:prod]

  3. #3
    User
    Join Date
    11-16-11.
    Location
    Hamburg
    Posts
    39

    Default SOLVED

    Quick solution:

    Code:
    # /web/.htaccess
    
    RewriteCond %{ENV:REDIRECT_APP_ENV} (.+)
    RewriteRule .* - [ENV=APP_ENV:%1]
    RewriteRule ^contao - [ENV=APP_ENV:prod]

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •