Symfony 路由不起作用 [英] Symfony routing not working
问题描述
我使用的是普通主机(即通过 public_html 访问网页,但无法访问 php (apache) 配置).
I am using a normal host (i.e access to web pages via public_html and no access to php (apache) configuration).
所以我做了什么
- 重命名我的网络目录 => public_html
- 将 app.php(生产应用程序)重命名为 index.php
我还在我的页面(模板)中添加了一个名为littlebird"的路由
I've also added a route to my page (template) named "littlebird"
问题
当我调用 www.mywebsite.com/littlebird => 404 页面未找到
when I call www.mywebsite.com/littlebird => 404 page not found
但是当我使用 www.mywebsite.com/index.php/littlebird 时,一切正常.
but when I use www.mywebsite.com/index.php/littlebird every thing works just fine.
推荐答案
我最初的猜测是您没有打开 mod_rewrite
.
My original guess was that you didn't have the mod_rewrite
turned on.
但在我们的讨论中,我们发现您已经用其他内容替换了原来的 .htaccess
.
But during our discussion we've found that you have replaced the original .htaccess
with something else.
原始 .htaccess
可以通过这个地址找到:https://github.com/symfony/symfony-standard/blob/master/web/.htaccess
The original .htaccess
could be found by this address: https://github.com/symfony/symfony-standard/blob/master/web/.htaccess
这篇关于Symfony 路由不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!