Symfony2:从HTTPS路由重定向到HTTP路由

I have the base route "/" like http://example.com and I want to redirect this route to http if someone calls https://example.com. What I am doing wrong? Do I have to put the redirect option somewhere else? THANKS!

In my routing yml I have:

my_website:
    resource: "@MyWebsiteBundle/Controller/"
    type:     annotation
    prefix:   /
    defaults:
        route: home //<-- This is my name of the route "/" in my controller
        permanent: true

In your routing.yml:

home:
    path:     /
    defaults: { _controller: AcmeBundle:Default:index     }
    host: "www.example.com"
    schemes:  [http] # This is where the magic happens!

An alternate solution if you want ALL routes you can go to your security.yml and change the access_control parameter to this :

access_control:
    - { path: ^/, roles: [IS_AUTHENTICATED_ANONYMOUSLY], requires_channel: http }

If you ever need https to access an admin :

access_control:
    - { path: ^/, roles: [IS_AUTHENTICATED_ANONYMOUSLY], requires_channel: http }
    - { path: ^/admin, roles: [ROLE_ADMIN], requires_channel: https }

More information can be found here : http://symfony.com/doc/current/book/security.html

Try this :

my_website:
    resource: "@MyWebsiteBundle/Controller/"
    type:     annotation
    prefix:   /
    requirements:
        _scheme:  http