【发布时间】:2021-09-21 12:16:46
【问题描述】:
我正在开发一个 larvel 项目,当我输入没有 /index.php 的 url(域)时,一切都很好。假设我的网址是https://example.com。当我访问此网址时,一切正常。但是如果我在最后添加/index.php 就像https://example.com/index.php 一样,我的资源(图像、视频)由于路径不匹配而无法加载。到目前为止,我发现我需要通过在 .htaccess 文件上定义规则来将 https://example.com/index.php 重定向到 https://example.com。
那么如何正确编写规则,以便在我输入 https://example.com/index.php 时重定向到 https://example.com ?
更新:在开发中,我的项目在 http://localhost:3000/Example 上运行。在这种情况下,我需要将此http://localhost:3000/Example/index.php 重定向到http://localhost:3000/Example。
【问题讨论】: