【发布时间】:2015-05-21 14:34:01
【问题描述】:
我有"/" 之类的基本路由http://example.com,如果有人调用https://example.com,我想将此路由重定向到http。我做错了什么?我是否必须将重定向选项放在其他地方?谢谢!
在我的路由 yml 中我有:
my_website:
resource: "@MyWebsiteBundle/Controller/"
type: annotation
prefix: /
defaults:
route: home //<-- This is my name of the route "/" in my controller
permanent: true
【问题讨论】:
-
这可能对 symfony.com/doc/current/cookbook/security/force_https.html 有所帮助,您最终不必在路线中处理此问题,而是在安全方面进行处理。