symfony 2 - 语言版本 - 找不到“GET /”的路线
symfony 2 - Language version - No route found for “GET /”
Symfony2 returns 当我尝试 运行 http://localhost/nl
时找不到 "GET /nl" 的路由
app/config/routing.yml
#hwi_oauth_redirect:
# resource: "@HWIOAuthBundle/Resources/config/routing/redirect.xml"
# prefix: /connect
#
#hwi_oauth_login:
# resource: "@HWIOAuthBundle/Resources/config/routing/login.xml"
# prefix: /login
softlogo_works:
resource: "@SoftlogoWorksBundle/Resources/config/routing.yml"
prefix: /{_locale}/
requirements:
_locale: en|pl|ru|fr|nl
#softlogo_news:
#resource: "@SoftlogoNewsBundle/Resources/config/routing.yml"
#prefix: /
sonata:
resource: "@SoftlogoCMSBundle/Resources/config/routing/sonata.yml"
prefix: /
#host: "{host}"
#requirements:
#host: "[a-zA-Z1-9\.\-]+"
#defaults: {host: "ngmina.localhost"}
gallery:
resource: '@SonataMediaBundle/Resources/config/routing/gallery.xml'
prefix: /media/gallery
media:
resource: '@SonataMediaBundle/Resources/config/routing/media.xml'
prefix: /media
news:
resource: '@SonataNewsBundle/Resources/config/routing/news.xml'
prefix: /{_locale}/news
requirements:
_locale: en|pl|ru|fr|nl
softlogo_portfolio:
resource: "@SoftlogoPortfolioBundle/Resources/config/routing.yml"
prefix: /{_locale}/projekty
requirements:
_locale: en|pl|ru|fr|nl
softlogo_product:
resource: "@SoftlogoProductBundle/Resources/config/routing.yml"
prefix: /product
requirements:
_locale: en|pl|ru|fr|nl
softlogo_shop:
resource: "@SoftlogoShopBundle/Resources/config/routing.yml"
prefix: /shop
requirements:
_locale: en|pl|ru|fr|nl
#softlogo_portfolio:
#softlogo_portfolio:
# resource: "@SoftlogoPortfolioBundle/Resources/config/routing.yml"
# prefix: /portfolio
#
softlogo_cms:
resource: "@SoftlogoCMSBundle/Resources/config/routing.yml"
prefix: /
simple_things_entity_audit:
resource: "@SimpleThingsEntityAuditBundle/Resources/config/routing.yml"
prefix: /audit
app/config/routing_dev.yml:
_wdt:
resource: "@WebProfilerBundle/Resources/config/routing/wdt.xml"
prefix: /_wdt
_profiler:
resource: "@WebProfilerBundle/Resources/config/routing/profiler.xml"
prefix: /_profiler
_configurator:
resource: "@SensioDistributionBundle/Resources/config/routing/webconfigurator.xml"
prefix: /_configurator
_errors:
resource: "@TwigBundle/Resources/config/routing/errors.xml"
prefix: /_error
_main:
resource: routing.yml
错误页面:
该站点包含5个语言版本,但问题仅出现在nl版本中,其他均正常。
我已经清理了缓存文件夹,但是没有效果。
可能是什么问题?
您应该在 app/config/config.yml
中启用区域设置
parameters:
locale: en
framework:
#esi: ~
translator: { fallbacks: ['%locale%'] }
您在前缀末尾添加了额外的“/”
softlogo_works:
resource: "@SoftlogoWorksBundle/Resources/config/routing.yml"
prefix: /{_locale}
requirements:
_locale: en|pl|ru|fr|nl
Symfony2 returns 当我尝试 运行 http://localhost/nl
时找不到 "GET /nl" 的路由app/config/routing.yml
#hwi_oauth_redirect:
# resource: "@HWIOAuthBundle/Resources/config/routing/redirect.xml"
# prefix: /connect
#
#hwi_oauth_login:
# resource: "@HWIOAuthBundle/Resources/config/routing/login.xml"
# prefix: /login
softlogo_works:
resource: "@SoftlogoWorksBundle/Resources/config/routing.yml"
prefix: /{_locale}/
requirements:
_locale: en|pl|ru|fr|nl
#softlogo_news:
#resource: "@SoftlogoNewsBundle/Resources/config/routing.yml"
#prefix: /
sonata:
resource: "@SoftlogoCMSBundle/Resources/config/routing/sonata.yml"
prefix: /
#host: "{host}"
#requirements:
#host: "[a-zA-Z1-9\.\-]+"
#defaults: {host: "ngmina.localhost"}
gallery:
resource: '@SonataMediaBundle/Resources/config/routing/gallery.xml'
prefix: /media/gallery
media:
resource: '@SonataMediaBundle/Resources/config/routing/media.xml'
prefix: /media
news:
resource: '@SonataNewsBundle/Resources/config/routing/news.xml'
prefix: /{_locale}/news
requirements:
_locale: en|pl|ru|fr|nl
softlogo_portfolio:
resource: "@SoftlogoPortfolioBundle/Resources/config/routing.yml"
prefix: /{_locale}/projekty
requirements:
_locale: en|pl|ru|fr|nl
softlogo_product:
resource: "@SoftlogoProductBundle/Resources/config/routing.yml"
prefix: /product
requirements:
_locale: en|pl|ru|fr|nl
softlogo_shop:
resource: "@SoftlogoShopBundle/Resources/config/routing.yml"
prefix: /shop
requirements:
_locale: en|pl|ru|fr|nl
#softlogo_portfolio:
#softlogo_portfolio:
# resource: "@SoftlogoPortfolioBundle/Resources/config/routing.yml"
# prefix: /portfolio
#
softlogo_cms:
resource: "@SoftlogoCMSBundle/Resources/config/routing.yml"
prefix: /
simple_things_entity_audit:
resource: "@SimpleThingsEntityAuditBundle/Resources/config/routing.yml"
prefix: /audit
app/config/routing_dev.yml:
_wdt:
resource: "@WebProfilerBundle/Resources/config/routing/wdt.xml"
prefix: /_wdt
_profiler:
resource: "@WebProfilerBundle/Resources/config/routing/profiler.xml"
prefix: /_profiler
_configurator:
resource: "@SensioDistributionBundle/Resources/config/routing/webconfigurator.xml"
prefix: /_configurator
_errors:
resource: "@TwigBundle/Resources/config/routing/errors.xml"
prefix: /_error
_main:
resource: routing.yml
错误页面:
该站点包含5个语言版本,但问题仅出现在nl版本中,其他均正常。 我已经清理了缓存文件夹,但是没有效果。
可能是什么问题?
您应该在 app/config/config.yml
parameters:
locale: en
framework:
#esi: ~
translator: { fallbacks: ['%locale%'] }
您在前缀末尾添加了额外的“/”
softlogo_works:
resource: "@SoftlogoWorksBundle/Resources/config/routing.yml"
prefix: /{_locale}
requirements:
_locale: en|pl|ru|fr|nl