Kohana3: Different .htaccess rewritebase and kohana base_url for dev and production environment

Posted by Svish on Stack Overflow See other posts from Stack Overflow or by Svish
Published on 2010-03-23T16:07:15Z Indexed on 2010/04/22 11:43 UTC
Read the original article Hit count: 541

Filed under:
|
|
|

In my bootstrap.php I have the following:

if($_SERVER['SERVER_NAME'] == 'localhost')
    Kohana::$environment = 'development';
else
    Kohana::$environment = 'production';

...

switch(Kohana::$environment)
{
    case 'development':
        $settings = array('base_url' => '/kohana/', 'index_file' => FALSE);
        break;

    default:
        $settings = array('base_url' => '/', 'index_file' => FALSE);
        break;
}

In .htaccesshave this:

# Installation directory
RewriteBase /kohana/

This means that if I just upload my kohana application, it will break because the RewriteBase in the .htaccess file will be wrong. Is there a way I can have a conditional in the .htaccess file similar to the one I have in the bootstrap so that it will use the correct RewriteBase?

© Stack Overflow or respective owner

Related posts about kohana-3

Related posts about kohana