symfony2 baseUrl无法与产品中的IIS一起使用


symfony2 baseUrl not working with IIS in prod

我在IIS服务器上安装了symfony2框架。

当我键入http://localhost/myAlias/app_dev.php时,它工作正常,我的路由是在http://localhost/myAlias/app_dev.php上发送我。

当我隐式键入http://localhost/myAlias app.php时,我会收到未找到"GET/myAlias"的路由和我的所有依赖文件(css/js),指向http://localhost/bundles/file.js

Symfony2似乎搞错了基本Url,其中没有/myAlias。但我读到IIS在没有适用于Apache 的Rewritebase/meyAlias的情况下运行良好

我的IIS web.config

<system.webServer>
        <defaultDocument enabled="true">
            <files>
                <add value="app.php" />
            </files>
        </defaultDocument>
        <rewrite>
            <rules>
                <rule name="call app.php" enabled="true" stopProcessing="true">
                    <match url="^(.*)$" />
                    <conditions logicalGrouping="MatchAll" trackAllCaptures="false">
                    </conditions>
                    <action type="Rewrite" url="app.php" />
                </rule>
            </rules>
        </rewrite>
</system.webServer>

我忘了勾选方框了吗?

您是否尝试过在prod环境中清除缓存?尝试以下命令:

Symfony 2.8-

php app/console cache:clear --env=prod --no-debug

Symfony 3.0+

php bin/console cache:clear --env=prod --no-debug