简体   繁体   中英

404 error when i add a new page

I have actually a problem when I want to get a new page in my website. When I am in localhost I have no problem with the page but when I want to get the new page in my prod server, I have a 404 error and I don't understand why :(

I use Symfony2 and my app/config/routing.yml is:

admin:
    resource: '@SonataAdminBundle/Resources/config/routing/sonata_admin.xml'
    prefix: /admin

_sonata_admin:
    resource: .
    type: sonata_admin
    prefix: /admin

logout:
    pattern:   /logout

#..................

kayser_platform:
    resource: "@KayserPlatformBundle/Resources/config/routing.yml"
    prefix:   /

_liip_imagine:
    resource: "@LiipImagineBundle/Resources/config/routing.xml"

and my myBundle/ressources/views/config/routing.yml is:

# faq 
kay_faq:
    path:    /faq
    defaults: { _controller: KayserPlatformBundle:Default:faq}

#sonata admin
admin:
    resource: '@SonataAdminBundle/Resources/config/routing/sonata_admin.xml'
    prefix: /admin

_sonata_admin:
    resource: .
    type: sonata_admin
    prefix: /admin

login:
    pattern:   /login
    defaults:  { _controller: KayserPlatformBundle:Default:login }

login_check:
    pattern:   /login_check

kay_test:
    path:    /test
    defaults: { _controller: KayserPlatformBundle:Default:test}

For example, the path /test doesn't work in prod but /fag works well. Does anyone have an idea?

After discussion in comments, the problem was located to be the cache for prod environment.

Solution : Clearing the cache solved the missing routes.

You can see your routes using the symfony2 command: php app/console router:debug

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM