簡體   English   中英

Laravel 9 部署在 Plesk 共享主機上的項目僅顯示主頁,其他路由不起作用

[英]Laravel 9 Project Deployed On Plesk Shared host shows the just the main page the other routes not working

我在 Plesk 上有一個共享主機,我已經在上面上傳了我的 Laravel 項目。 我已將項目放在根文件夾中,並將托管設置中的文檔根目錄更改為屬於我的項目的公用文件夾

當我打開網站時,第一頁工作正常,但當我嘗試移動到另一頁時,它給了我一個 404 錯誤,這意味着我的路線不起作用

我已經通過添加一個解決了

web.config

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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM