问题
I try to redirect to a route after the succes of my form.. In dev it works perfectly
my html:
<input type="hidden" name="_target_path" value="{{ path('homepage') }}" />
my router:
homepage:
path: /homepage
defaults: { _controller: 'App\Controller\HomePageController::hello' }
I am redirected to :
http://localhost:8000/homepage
The problem is that in prod environment
I am redirected to: https://mydomain.fr/mywebsite/public/mywebsite/public/homepage
What I have to do in prod to be redirected to https://mydomain.fr/mywebsite/public/homepage
For info I use the webserver provided by symfony in local http://localhost:8000/
Thanks in advance for your help.
回答1:
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
来源:https://stackoverflow.com/questions/48964316/the-path-defined-in-the-route-is-not-correct-symfony