I have made a web application in the symfony 2 framework. This is working fine but now i want to change the http:// to https:// for all the routes!
And how can I check if my environment is localhost in this. If I work locally I want to use the normal http://.
Where to set this, i can't find it?
Thanks!
Here you go: (Not tested but should work.)
# app/config/security.yml
security:
# ...
access_control:
- { path: ^/, roles: IS_AUTHENTICATED_ANONYMOUSLY, requires_channel: https, host: yourdomain\.com$ }
- { path: ^/, roles: IS_AUTHENTICATED_ANONYMOUSLY, requires_channel: http, host: localhost$ }
http://symfony.com/doc/current/cookbook/security/access_control.html#forcing-a-channel-http-https
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With