首页 > 解决方案 > Laravel 6.0 IIS 添加虚拟目录 HTTP 错误 404.0 - 未找到

问题描述

我在 Windows 10 主机中使用 IIS 运行 Laravel 项目并且在主页上它工作但我单击登录或注册它不起作用?

这是我的设置(添加虚拟目录) 在此处输入图像描述

如果 localhost/tms 它工作但 localhost/tms/login HTTP 错误 404

标签: laraveliisvirtual-directory

解决方案


感谢您提供答案这是我的答案

在公共目录中添加文件 web.config 并粘贴规则:

<?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>
</configuration> 

来自 https://stackoverflow.com/a/45464268/8556614


推荐阅读