简体   繁体   English

当我添加新页面时出现404错误

[英]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 :( 当我在localhost时,页面没有问题,但是当我想在产品服务器中获取新页面时,出现404错误,我不明白为什么:(

I use Symfony2 and my app/config/routing.yml is: 我使用Symfony2,而我的app / config / routing.yml是:

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: 而我的myBundle / ressources / views / config / routing.yml是:

# 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. 例如,路径/ test在prod中不起作用,但是/ fag很好用。 Does anyone have an idea? 有人有主意吗?

After discussion in comments, the problem was located to be the cache for prod environment. 经过评论讨论后,问题被定位在prod环境的cache中。

Solution : Clearing the cache solved the missing routes. 解决方案 :清除缓存可以解决缺少的路由。

You can see your routes using the symfony2 command: php app/console router:debug 您可以使用symfony2命令查看路由: php app/console router:debug

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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