Saturday, 15 May 2010

php - Symfony 2 routing doesnt work in prod -



php - Symfony 2 routing doesnt work in prod -

im developed pretty simple blog in symfony. there 2 bundles: blog , admin both fine in dev enviroment.. main admin route doesnt seem work in prod throws 404. every other route (e.g. /admin/categories , on) works /admin works if write /app_dev.php/admin. cleared cache. dont think inserted code block admin cos dont know such things.. dont know code snippets need debugging sorry update if inquire one.

admin route:

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 route:

blog_homepage: path: / defaults: { _controller: blogbundle:main:index } requirements: _method: blog_homepaginated: path: /page/{pagenumber} defaults: { _controller: blogbundle:main:index } blog_categorypage: path: /{thecategory} defaults: { _controller: blogbundle:main:showcategory } requirements: _method: blog_categorypaginated: path: /{thecategory}/page/{pagenumber} defaults: { _controller: blogbundle:main:showcategory } requirements: _method: blog_tagpage: path: /tag/{tag} defaults: { _controller: blogbundle:main:tag } blog_showpost: path: /{thecategory}/{title} defaults: { _controller: blogbundle:main:showpost } requirements: _method: blog_tagpaginated: path: /tag/{tag}/page/{pagenumber} defaults: { _controller: blogbundle:main:tag }

security:

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 }

make sure register created bundles in kernel here, prod section:

$bundles = array(...);

leave registered dev bundles this:

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(); }

also if in app.php file see false (parameter testing):

$kernel = new appkernel('prod', false);

change false true:

$kernel = new appkernel('prod', true);

hope helped, have nice day.

php symfony2 routing

No comments:

Post a Comment