php - How to select environment in Laravel 4 using .htaccess? -


i have site in testing phase, connects not real data local copy of database.

my customer needs fast link retrieve urgent , important pdf reports, need set version of site links "real data".

i can create 2 environments ("local" , "real") different database connections, , give opportunity select environment via url (i know it's not pretty security point of view, let's take granted).

so use:

my.ip.address/mysite use test db

my.ip.address/mysite/real use real db, redirecting urls without "real folders".

f.ex.: /mysite/real/admin should redirect /mysite/admin selecting "real" environment on laravel 4.

  1. is possible pattern-match folders in laravel 4 or possible domains? in other words, work?

    $env = $app->detectenvironment(array(     'test' => array('*/mysite/*'),     'real' => array('*/mysite/real/*'), )); 
  2. if so, can't figure out how write .htaccess rule, i've tried

    rewriterule ^/real(.*)$ $1 

but won't work.

i'm not sure if laravel's internal environment handling works folders, works subdomains. choose setup app using 2 apache vhosts, 1 named test.example.local, 1 named real.example.local , set environment option in laravel this:

$env = $app->detectenvironment(array(     'test' => array('test.example.local'),     'real' => array('real.example.local'), )); 

there's second option using .htaccess: set in .htaccess...

setenv laravel_environment test setenv laravel_environment real 

then set environment in laravel so:

$env = $app->detectenvironment(function() {     return $_server['laravel_environment']; }); 

Comments

Popular posts from this blog

css - Which browser returns the correct result for getBoundingClientRect of an SVG element? -

gcc - Calling fftR4() in c from assembly -

Function that returns a formatted array in VBA -