作者热门文章
- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我有一个简单的 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/
我是一名优秀的程序员,十分优秀!