[英]Laravel 9 Project Deployed On Plesk Shared host shows the just the main page the other routes not working
I have a shared host on Plesk and I have upload my Laravel Project on it.我在 Plesk 上有一个共享主机,我已经在上面上传了我的 Laravel 项目。 I have put the project in the root folder and change the document root in hosting settings to public folder that belong to my project我已将项目放在根文件夹中,并将托管设置中的文档根目录更改为属于我的项目的公用文件夹
When I open the website the first page works fine but when I try to move to another page it gives me an 404 error which mean that my route doesn't work当我打开网站时,第一页工作正常,但当我尝试移动到另一页时,它给了我一个 404 错误,这意味着我的路线不起作用
I have solved it by adding a我已经通过添加一个解决了
web.config web.config
file inside the public folder and put the following code in it: public 文件夹中的文件并将以下代码放入其中:
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Imported Rule 1" stopProcessing="true">
<match url="^(.*)/$" ignoreCase="false" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
</conditions>
<action type="Redirect" redirectType="Permanent" url="/{R:1}" />
</rule>
<rule name="Imported Rule 2" stopProcessing="true">
<match url="^" ignoreCase="false" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
</conditions>
<action type="Rewrite" url="index.php" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.