我正在尝试在IIS中运行超薄应用程序,我将其添加为默认网站中的应用程序,我已经从.htaccess
导入了规则,并将物理地址更新为public
,但是仍然找不到页面请注意,当我将其添加为网站(不在“默认”网站中)时,它可以工作!但是我需要在默认网站中运行它,才能使用公共IP通过网络访问它。
这里是web.config文件
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="Imported Rule 1" stopProcessing="true">
<match url="^" ignoreCase="false" />
<conditions logicalGrouping="MatchAll">
<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" appendQueryString="true" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
任何建议都非常感谢!
错误的原因是由于先前添加了其他设置,以使Slim App在dependencies.php
文件中的Apache服务器中工作,因此>
$container['environment'] = function () { // Fix the Slim 3 subdirectory issue (#1529) // This fix makes it possible to run the app from localhost/slim3-app $scriptName = $_SERVER['SCRIPT_NAME']; $_SERVER['REAL_SCRIPT_NAME'] = $scriptName; $_SERVER['SCRIPT_NAME'] = dirname(dirname($scriptName)) . '/' . basename($scriptName); return new Slim\Http\Environment($_SERVER); };
通过删除它并检查项目权限,我可以正常运行!