Welcome Guest, Not a member yet? Register   Sign In
Problems with .htaccess and environments?
#1

Here is my .htaccess file:

Code:
RewriteEngine On
SetEnvIf Host www.mysite.ca$ CI_ENV=production
SetEnvIf Host test.mysite.ca$ CI_ENV=testing
SetEnvIf Host localhost$ CI_ENV=development

RewriteCond $1 !^(index\\.php|resources|robots\\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L,QSA]

And this is what I have in index.php

Code:
define('ENVIRONMENT', isset($_SERVER['CI_ENV']) ? $_SERVER['CI_ENV'] : 'development');

if (defined('ENVIRONMENT'))
{
    switch (ENVIRONMENT)
    {
        case 'development':
            error_reporting(E_ALL);
        break;

        case 'testing':
        case 'production':
            error_reporting(0);
        break;

        default:
            exit('The application environment is not set correctly.');
    }
}

So Im doing something wrong, because I uploaded the application to www.mysite.ca and it keeps defaulting to development, not production.
Do the one thing you think you cannot do. Fail at it. Try again. Do better the second time. The only people who never tumble are those who never mount the high wire.
Reply


Messages In This Thread
Problems with .htaccess and environments? - by lexxtoronto - 04-30-2015, 08:27 AM



Theme © iAndrew 2016 - Forum software by © MyBB