IIS+PHP-Url重写问题


IIS + PHP - Url Rewrite Issue

首先,我的英语不太好,那是因为我找不到我找到的东西。

好的,这是我的web.config规则

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
            <rule name="Imported Rule 1">
                <match url="^Girisyap$" ignoreCase="true" />
                <conditions logicalGrouping="MatchAll">
                    <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
                    <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                </conditions>
                <action type="Rewrite" url="giris.php" />
            </rule>
                <rule name="Imported Rule 2" stopProcessing="true">>
                  <match url="^([0-9a-zA-Z-_/]+)$" />
                  <action type="Rewrite" url="Sayfalar.php?Sayfa={R:1}" appendQueryString="true" />
                </rule>
            </rules>
        </rewrite>
        <directoryBrowse enabled="false" />
    </system.webServer>
</configuration>

有了这些规则,当我尝试访问http://localhost:84/Girisyap时,它也会显示giris.php
如果我访问http://localhost:84/Around显示Sayfalar.php?Sayfa=也可以。
但当我访问http://localhost:84/时,它给了我403.14-禁止的错误。因为我没有使用index.php或default.php,我不想要它。
如何显示'Sayfalar.php?Sayfa='(Sayfa为空)访问http://localhost:84/以及

在Apache中,您会在htdocs中找到一个index.php文件,该文件会将默认网站设置为xampp文件夹(默认情况下)。也许你一定在IIS中找到了同样的情况。尝试将默认网站编辑到您网站的目录中,也许您可以设置绑定到其他端口(根据您的需要,它可以使用=84)。祝你好运,它对我有用。将此代码添加到web.config文件

<system.webServer>
     <defaultDocument>
        <files>
          <add value="Login.aspx" />
        </files>
     </defaultDocument>
     <directoryBrowse enabled="false" />
</system.webServer>

注意:Login.aspx就是一个例子。将其更改为默认文档。