1

Symfony2 has by default 2 environments. Dev and production.

What's you default vhost config and why? Do you point directly to app_dev.php or do you rewrite the .htaccess to redirect to it?

Do you have 2 vhosts or did you rewrite the entry point (index) to read a config to easily change environments?

On production, I'll just have one entry point and point directly to it and leave the .htaccess there.

Please post your approach since Symfony2 doesn't tell me anythign about this. It only says that we should point our vhost to the web dir.

Maybe you always add the app_dev.php part to the url? What are you doing. Tell me your experience.

I did read the other stuff here about this.

1
  • 1
    Why a downvote? Symfony2 doesn't recommend anything explitic so asking isn't bad. Commented Sep 3, 2013 at 14:33

1 Answer 1

3

Follow Sf2 recommandations and let your vhost point to web directory. The provided .htaccess file will automatically redirect to app.php if no index is specified, and you type app_dev.php to access dev environment...

If you want to install a vhost dedicated to dev environment, make it rewrite URL to point on app_dev.php.

Sign up to request clarification or add additional context in comments.

4 Comments

But adding php_dev.php to your url is annoying. On a productive system I'd delete the dev environment and use the htaccess like it is. But for developing, there must be something nicer. I'll probably just point my vhost directly to app_dev.php so I don't have to change .htaccess. If I want to switch environment I can just add app.php. What about this approach? Why do they recommend pointing at /web and not at /web/app.php? Would it get in conflict if you add app.php if it already pointed to web/app.php?
Because you can have multiple environments it's easy to switch with app_env.php instead of writing a vhost for each.
I know that you can have several environments. So they really intendend to switch the environments via the URL? Just sounds very annoying since most of the time you are using on of them, so why not set it as default somehow.
Provided config set is suitable for "production oriented" installations, but you are free to make it up to your needs !

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.