路由中定义的路径不正确 symfony [英] the path defined in the route is not correct symfony
问题描述
我尝试在表单成功后重定向到路由..在开发中它完美运行
I try to redirect to a route after the succes of my form.. In dev it works perfectly
我的 html:
<input type="hidden" name="_target_path" value="{{ path('homepage') }}" />
我的路由器:
homepage:
path: /homepage
defaults: { _controller: 'App\Controller\HomePageController::hello' }
我被重定向到:
http://localhost:8000/homepage
问题是在 prod 环境中
The problem is that in prod environment
我被重定向到:https://mydomain.fr/mywebsite/public/mywebsite/public/homepage
我必须做什么才能被重定向到https://mydomain.fr/mywebsite/public/homepage
What I have to do in prod to be redirected to https://mydomain.fr/mywebsite/public/homepage
有关信息,我在本地使用 symfony 提供的网络服务器http://localhost:8000/
For info I use the webserver provided by symfony in local http://localhost:8000/
预先感谢您的帮助.
推荐答案
将您的项目与 public_html 放在同一个目录中作为兄弟.然后删除 public_html 目录并将其重新创建为指向您的项目公共目录的符号链接.然后确保你安装了 Apache-pack 包,它会创建 .htaccess 文件,你应该很好.在 A2host 上为我工作
Put your project in the same dir as public_html as a sibling. Then remove the public_html dir and recreate it as a symlink pointing to your project public dir. then make sure you install Apache-pack bundle it will create the .htaccess file and you should be good. Worked for me on A2host
这篇关于路由中定义的路径不正确 symfony的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!