I have a site with some static pages and I have defined as follow in routing_pages.yml
file:
index:
pattern: /inicio
defaults: { template: 'FrontendBundle:Site:index.html.twig' }
contact_one:
pattern: /contact_one
defaults: { template: 'FrontendBundle:Site:contact.html.twig' }
location:
pattern: /horario
defaults: { template: 'FrontendBundle:Site:location.html.twig' }
payment:
pattern: /pagos
defaults: { template: 'FrontendBundle:Site:payment.html.twig' }
question:
pattern: /preguntas
defaults: { template: 'FrontendBundle:Site:question.html.twig' }
questionb:
pattern: /preguntasb
defaults: { template: 'FrontendBundle:Site:questionb.html.twig' }
shipping:
pattern: /politicasenvio
defaults: { template: 'FrontendBundle:Site:shipping.html.twig' }
warranties:
pattern: /garantias
defaults: { template: 'FrontendBundle:Site:warranties.html.twig' }
ml:
pattern: /ml
defaults: { template: 'FrontendBundle:Site:forms.html.twig' }
Then at main routing.yml
file I use the resource as:
_paginas:
resource: routing_pages.yml
prefix: /
defaults:
_controller: FrameworkBundle:Template:template
I'm having some issues trying to access /app_dev.php|app.php
route with this exception:
No route found for "GET /"
This is due to the configuration I have on access_control
at security.yml
:
access_control:
#Security Login/Register/Resetting
- { path: ^/login$, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/register, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/resetting, role: IS_AUTHENTICATED_ANONYMOUSLY }
#Frontend Pages Routes
- { path: ^/inicio, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/contact_one, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/horario, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/pagos, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/preguntas, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/preguntasb, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/politicasenvio, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/garantias, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/ml, role: IS_AUTHENTICATED_ANONYMOUSLY }
#Login required
- { path: ^/, role: ROLE_USER }
- { path: ^/admin/, role: ROLE_ADMIN }
What I did like that? Because the stactic pages doesn't need login features just admin area does. I tried play with this two lines by changing to this:
- { path: ^/, role: IS_AUTHENTICATED_ANONYMOUSLY }
- { path: ^/admin/, role: ROLE_ADMIN }
But then when I access `app_dev.php|app.php/admin I don't see the login form, why? How I fix that? Any advice?
If I could define /inicio
as homepage
in somewhere or somehow then the problem is fixed, tough, but I don't know how to.