Tom
Tom

Reputation: 2873

symfony2 access test environment by subdomain?

I'm looking for a way to expose my test environment via a subdomain. Basically, I want to do the equivalent of the console --env "test" via URL. So someone accessing http://example.com will get the production site, but the external testers can go to http://test.example.com and will get the test environment, with test database and everything.

I thought just using SetEnv ENV "test" in my apache config would do the trick, but apparently it doesn't.

I'm fairly sure this is a pretty common thing, so can someone guide me to the solution?

Upvotes: 0

Views: 165

Answers (1)

Igor Pantović
Igor Pantović

Reputation: 9246

It's really weird that you're trying to access test environment through url, but I'll guess you need some special configuration for WebTestCases.

You need to create app_test.php file in web directory, and boot kernel with 'test' environment parameter. To see how to do it, check out already available app.php and app_dev.php files.

After that, setup your apache to aim for app_test.php when you hit your url. Also have in mind that you will probably have to make apache ignore .htaccess because it will point it to app.php. You can do it using AllowOverride None.

Upvotes: 1

Related Questions