Yêu cầu khoảng 14 giờ trước 7 0 0
  • 7 0 0
0

cấu hình subfolder trên IIS/Plesk.

Chia sẻ
  • 7 0 0

Mình có deploy 1 dự án laravel trên IIS/Plesk. Domain gốc của dự án là abc.com Subfolder là project_a Khi mình truy cập vào abc.com/project_a thì vào trang home bình thường nhưng khi click sang 1 tab khác như abc.com/project_a/location.html thì bị redirect về trang 404 nhưng f5 lại thì vào các trang khác bình thường và chỉ bị lần đầu tiên đối với 1 trình duyệt mới đây là file web.config của mình

<?xml version="1.0" encoding="UTF-8"?> <configuration> <system.webServer> <!--<httpProtocol> <customHeaders> <add name="Cache-Control" value="public, max-age=31536000" /> </customHeaders> </httpProtocol>--> <rewrite> <rules> <remove name="Imported Rule 1" /> <remove name="Imported Rule 2" /> <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>

à mình có đặt web.config này ở thư mục gốc của dự án cùng cấp với .env và đưa index.php ra ngoài cùng luôn

Viblo
Hãy đăng ký một tài khoản Viblo để nhận được nhiều bài viết thú vị hơn.
Đăng kí