gpt4 book ai didi

windows - IIS7 上的 Laravel 5 不适用于 web.config

转载 作者:可可西里 更新时间:2023-11-01 11:25:22 26 4
gpt4 key购买 nike

我有一个简单的 Laravel 5 应用程序。它是在 Xampp 上开发的,并且运行良好。我将它复制到生产服务器上,但它不起作用。 web.config 文件有问题,因为如果我删除它,那么该应用程序将与 index.php/path 完美配合

我的网络配置如下:

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Rule 1" stopProcessing="true">
<match url="^(.*)/$" ignoreCase="false" />
<action type="Redirect" redirectType="Permanent" url="/{R:1}" />
</rule>
<rule name="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>

该应用程序位于网站的子文件夹中,我无法创建新站点,但我可以根据需要重新启动 IIS。我真的不太了解 IIS(事实上我讨厌它),所以我不知道在哪里检查,但由于该应用程序在没有 web.config 的情况下工作,我认为它一定是罪魁祸首。

最佳答案

IIS 需要有 URL 重写模块 才能让 Laravel web.config 工作。

在 XAMPP 上,它开箱即用,因为包含 Apache mod_rewrite 模块,并且 XAMPP 已经提供了大部分配置设置。

Microsoft URL Rewrite. Download it from here

关于windows - IIS7 上的 Laravel 5 不适用于 web.config,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40305426/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com