Symfony 路由仅适用于 frontend_dev (1.4.12)
大家好,我遇到了一个奇怪的 symfony 问题。
我目前正在本地主机上进行开发,当我关闭 frontend_dev 时,不再有任何路由可以工作。只是索引://
我将为您举一个例子来指定我的问题:
localhost:8080/frontend_dev.php/ ->显示索引 本地主机:8080 ->显示索引
localhost:8080/frontend_dev.php/some_route ->显示它的去向 本地主机:8080/some_route ->在此服务器上找不到 URL。
我的问题是:如何在不不断 frontend_deving 的情况下让我的页面再次工作?
Hi guys I'm having a strange symfony problem.
I'm developing currently on my localhost and when I turn of frontend_dev no route is working anymore. Just the index ://
I'll make an example for you to specify my problem:
localhost:8080/frontend_dev.php/ -> shows the index
localhost:8080 -> shows the index
localhost:8080/frontend_dev.php/some_route -> shows where its going
localhost:8080/some_route -> URL not found on this server.
My question is: How can I get my page to work again without constantly frontend_deving?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
当您链接到视图中的路线时,应始终使用内置辅助函数,例如
url_for()
和link_to()
。这些函数使用settings.yml
和routing.yml
来生成路由。使用此结构时,您可以通过在
routing.yml
中更新 URL 来轻松更改 URL,然后自动在视图中更新所有 URL。此外,通过在
settings.yml
(针对您选择的环境)中设置no_script_name
设置,frontend_dev.php
(前端控制器)会自动添加到前面当需要时。When you link to a route in your view, you should always use the built-in helper functions like
url_for()
andlink_to()
. These functions use thesettings.yml
androuting.yml
to generate the routes.When you use this structure, you can easily change an url by updating it in the
routing.yml
, and then automatically all URL's are updated in the view.Also, by setting the
no_script_name
setting in thesettings.yml
(for your selected environment) thefrontend_dev.php
(frontend controller) is automatically prepended when needed.我发现了错误。我的问题是切换到禁用了
mod_rewrite
的新 apache。I found the error. My problem was the switch to a new apache which had
mod_rewrite
disabled.