首页 > 解决方案 > PHP 网站无法在 IIS 上正常运行

问题描述

我们运行一个主站点,并希望在 /tesmer 文件夹下运行第二个站点。在演示站点上它运行良好。当我将它上传到 Windows 服务器上时,/tesmer/ 会正确显示。任何喜欢 /tesmer/smmm-sinav-islemleri 的子页面都有 404 错误。

我们使用 Url rewrite,在 IIS 下似乎 url rewrite 有问题。

开发站点下的工作页面:http: //demo.dijitall.net/izsm/tesmer/smmm-sinav-islemleri

IIS / Windows Server 2016 上的非工作页面 http://yeni.izsmmmo.org.tr/tesmer/smmm-sinav-islemleri

下面是 /tesmer 文件夹中的 web.config 文件

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="Imported Rule 10">
                    <match url="^([0-9a-zA-Z-_/]+)$" 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?par={R:1}" appendQueryString="false" />
                </rule>
                <rule name="Imported Rule 20" stopProcessing="true">
                    <match url="^resimmap.xml$" ignoreCase="false" />
                    <action type="Rewrite" url="resimmap.php" />
                </rule>
            </rules>
        </rewrite>
        <httpErrors errorMode="Detailed" />
    </system.webServer>
</configuration>

解决方案是什么?正确的 url 写入规则或其他内容?

标签: phpiisurl-rewriting

解决方案


我已经添加了该规则:

<rule name="tesmer22" stopProcessing="true">

  <match url="^tesmer/([0-9a-zA-Z-_/]+)$" 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="tesmer\index.php?par={R:1}" />        

</rule>   

推荐阅读