![](/img/trans.png)
[英]Yii2/PHP/IIS7 - URL Rewrite and File Permissions (Pretty URL issue)
[英]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 = Around以及。
但是當我訪問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是一個示例。 將其更改為默認文檔。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.