我正在使用SonataAdminBundle,并且希望安全区域位于/admin
下,并且我想在/
上有一个对象列表的主页。
但是当我继续/
时,我会自动重定向到/admin/dashboard
。
如果我的“首页”位于另一个网址(例如:/homepage
)下,此方法就可以正常工作
这是我的config.yml
:
sonata_admin:
title: 'Versus'
title_logo: 'logo_title.png'
templates:
# other configuration options
search: '@SonataAdmin/Core/search.html.twig'
search_result_block: 'template/Admin/Search/block_search_result.html.twig'
edit: 'template/Admin/CRUD/edit.html.twig'
global_search:
empty_boxes: fade
sonata_block:
blocks:
# enable the SonataAdminBundle block
sonata.admin.block.admin_list:
contexts: [admin]
sonata.admin.block.search_result:
contexts: [admin]
fos_user:
db_driver: orm # other valid values are 'mongodb' and 'couchdb'
firewall_name: admin
user_class: AppBundle\Entity\User
from_email:
address: "%mailer_user%"
sender_name: "%mailer_user%"
这是我的security.yml
:
firewalls:
main:
pattern: ^/
form_login:
provider: fos_userbundle
csrf_token_generator: security.csrf.token_manager
# if you are using Symfony < 2.8, use the following config instead:
# csrf_provider: form.csrf_provider
logout: true
anonymous: true
# disables authentication for assets and the profiler, adapt it according to your needs
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
这是我的routing.yml
:
admin_area:
resource: '@SonataAdminBundle/Resources/config/routing/sonata_admin.xml'
prefix: /admin
_sonata_admin:
resource: .
type: sonata_admin
prefix: /admin
fos_user:
resource: "@FOSUserBundle/Resources/config/routing/all.xml"
front:
resource: "@AppBundle/Controller/*"
type: annotation
prefix: /
我不知道是什么原因导致了重定向,以及如何防止重定向。