管理路线:
admin_image_upload:
path: /imageupload
defaults: { _controller: SzoBeszAdminBundle:Admin:imageUpload }
admin_posts:
path: /admin
defaults: { _controller: SzoBeszAdminBundle:Admin:index }
admin_posts_paginated:
path: /admin/posts/{pageNumber}
defaults: { _controller: SzoBeszAdminBundle:Admin:index }
admin_categories:
path: /admin/categories
defaults: { _controller: SzoBeszAdminBundle:Admin:category }
admin_category_submit:
path: /admin/categorysubmit
defaults: { _controller: SzoBeszAdminBundle:Admin:categorySubmit }
admin_post_submit:
path: /admin/postsubmit
defaults: { _controller: SzoBeszAdminBundle:Admin:postSubmit }
requirements:
_method: GET|POST
admin_post_edit:
path: /admin/post/edit/{id}
defaults: { _controller: SzoBeszAdminBundle:Admin:postEdit }
requirements:
id: \d+
admin_post_delete:
path: /admin/post/delete/{id}
defaults: { _controller: SzoBeszAdminBundle:Admin:postDelete }
requirements:
id: \d+
admin_category_edit:
path: /admin/category/edit/{id}
defaults: { _controller: SzoBeszAdminBundle:Admin:categoryEdit }
requirements:
id: \d+
admin_category_delete:
path: /admin/category/delete/{id}
defaults: { _controller: SzoBeszAdminBundle:Admin:categoryDelete }
requirements:
id: \d+
博客路线:
blog_homepage:
path: /
defaults: { _controller: BlogBundle:Main:index }
requirements:
_method: GET
blog_homepaginated:
path: /page/{pageNumber}
defaults: { _controller: BlogBundle:Main:index }
blog_categorypage:
path: /{theCategory}
defaults: { _controller: BlogBundle:Main:showCategory }
requirements:
_method: GET
blog_categorypaginated:
path: /{theCategory}/page/{pageNumber}
defaults: { _controller: BlogBundle:Main:showCategory }
requirements:
_method: GET
blog_tagpage:
path: /tag/{tag}
defaults: { _controller: BlogBundle:Main:tag }
blog_showpost:
path: /{theCategory}/{title}
defaults: { _controller: BlogBundle:Main:showPost }
requirements:
_method: GET
blog_tagpaginated:
path: /tag/{tag}/page/{pageNumber}
defaults: { _controller: BlogBundle:Main:tag }
安全性:
security:
encoders:
Symfony\Component\Security\Core\User\User: plaintext
role_hierarchy:
ROLE_ADMIN: ROLE_USER
ROLE_SUPER_ADMIN: [ROLE_USER, ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH]
providers:
in_memory:
memory:
users:
szobeszadmin: { password: ***, roles: [ 'ROLE_SUPER_ADMIN' ] }
firewalls:
dev:
pattern: ^/(_(profiler|wdt)|css|images|js)/
security: false
admin_secured:
pattern: ^/
anonymous: ~
http_basic:
realm: "Secured Area"
access_control:
- { path: ^/admin, roles: ROLE_SUPER_ADMIN }
答案 0 :(得分:1)
确保您在内核中注册所有您创建的捆绑包,这是一个产品部分:
$bundles = array(...);
保留已注册的开发包,如下所示:
if (in_array($this->getEnvironment(), array('dev', 'test'))) {
$bundles[] = new Symfony\Bundle\WebProfilerBundle\WebProfilerBundle();
$bundles[] = new Sensio\Bundle\DistributionBundle\SensioDistributionBundle();
$bundles[] = new Sensio\Bundle\GeneratorBundle\SensioGeneratorBundle();
}
另外,如果在app.php文件中你看到false(参数用于测试):
$kernel = new AppKernel('prod', false);
将false更改为true:
$kernel = new AppKernel('prod', true);
希望它有所帮助,祝你度过愉快的一天。
答案 1 :(得分:0)
确保在Apache中启用了mod_rewrite模块。
请参阅here获取一些帮助。
答案 2 :(得分:0)
问题是我在web文件夹中创建了一个admin文件夹,所以apache尝试使用该文件夹的/ admin路由而不是我设置的路由。