繁体   English   中英

IIS7上的Laravel 5无法与web.config一起使用

[英]Laravel 5 on IIS7 does not work with web.config

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

我的webconfig如下:

<?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 Rewrite Module才能使Laravel web.config正常工作。

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

Microsoft URL重写。 这里下载

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM