在除root以外的所有路径上均未找到Symfony 4404页面 [英] Symfony 4 404 Page not found on all routes except root
问题描述
我在共享主机上安装了symfony 4。
我的结构是这样的:
I have installed symfony 4 on my shared hosting. My structure is like this:
ROOT
|
|-- public_html
|
|-- tst
|-- tst
|
|-- bin
|-- config
|-- src
|-- translations
|-- var
|-- vendor
|-- composer.json
|-- composer.lock
|-- binsymfony.lock
我将index.php从公用文件夹移动到public_html / tst文件夹,并更改了该文件中的路径以匹配新结构:
I moved index.php from the public folder to the public_html/tst folder and changed the paths inside that file to match the new structure:
require __DIR__.'/../../tst/vendor/autoload.php';
现在,当运行 http:// mysite / tst ,我可以按预期获得该网站的主页。但是,当我尝试其他路线(而不是 /)时,总是会收到未找到404页面。
Now, when running http://mysite/tst, I get the homepage of the site as expected. But when I try another route (other than "/"), I always receive a 404 page not found.
这是否与我缺少的特权有关?
Does this have something to do with privileges of am I missing something?
我自己想出了一个,但是如果有人告诉我如何将Symfony 4应用程序部署到共享主机上,请告诉我!我想其他人也会喜欢这个...
I figured this one out myself, but if someone tell me how to deploy a Symfony 4 application to a shared hosting, please tell me! I think other people will like this too...
推荐答案
您可以为Public创建symlik。
You can create symlik for Public. The method you try can lead to problems.
# Enter Directory Root
cd /root_dir
# Create Symlink
ln -s public_html tst/public
这篇关于在除root以外的所有路径上均未找到Symfony 4404页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!