gpt4 book ai didi

php - IIS 服务器,如何为 Laravel 5 配置 url 重写?

转载 作者:可可西里 更新时间:2023-10-31 23:36:15 27 4
gpt4 key购买 nike

目前,Uni 只提供了一个IIS 服务器来托管我们的php 网站,我们想使用Laravel 框架,它在主页上运行。但不是在任何其他 Controller 上。

我的公用文件夹中的当前 web.config 是,

<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Imported Rule 1" stopProcessing="true">
<match url="^(.*)/$" ignoreCase="false" />
<conditions>
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
</conditions>
<action type="Redirect" redirectType="Permanent" url="/{R:1}" />
</rule>
<rule name="Imported 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>

我的路线是,

Route::get('/', function () {
return view('welcome');
});

Auth::routes();

Route::get('/home', 'HomeController@index')->name('home');

我对 IIS 不是很了解,所以您有什么想法来配置它以使其工作吗?

附言我们没有权限在营地配置IIS服务器,我们有权限做的是上传web.config

提前致谢。

最佳答案

我遇到了同样的问题。经过多次尝试和研究,我意识到 web.config 是不够的。必须在 IIS 路由设置中设置根文件夹的路径,如下面的屏幕截图示例所示。 laravel path on IIS .否则我无法解决路由问题。

关于php - IIS 服务器,如何为 Laravel 5 配置 url 重写?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50561072/

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