Windows Server + IIS和Cakephp 3.x的重写规则

问题描述 投票:1回答:0

我想将我的站点从linux部署到Windows托管。 在Linux服务器上,一切正常。 但很少有东西在Windows服务器上不起作用。

请让我知道我需要在web.config中进行哪些更改

我的文件系统是:

-src
-webroot
--css
--about.html
--index.php
--contact.php

现在,我如何直接访问about.html http://www.example.com/about.html ,同样也可以访问其他php文件。

这些是我现在使用的规则:

<rewrite>
    <rules>
        <rule name="Exclude direct access to webroot/*"
          stopProcessing="true">
            <match url="^webroot/(.*)$" ignoreCase="false" />
            <action type="None" />
        </rule>
        <rule name="Rewrite routed access to assets(img, css, files, js, favicon)"
          stopProcessing="true">
            <match url="^(assets|font|fonts|img|images|css|files|js|favicon.ico)(.*)$" />
            <action type="Rewrite" url="webroot/{R:1}{R:2}"
              appendQueryString="false" />
        </rule>
        <rule name="Rewrite requested file/folder to index.php"
          stopProcessing="true">
            <match url="^(.*)$" ignoreCase="false" />
            <action type="Rewrite" url="index.php"
              appendQueryString="true" />
        </rule>
    </rules>
</rewrite>
url-rewriting cakephp-3.0
© www.soinside.com 2019 - 2024. All rights reserved.