2014-09-26 125 views
0

首先,我的英語不太好,那是因爲我找不到我發現的東西。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://本地主機:84/Girisyap它顯示giris.php爲好。
如果我訪問http:// localhost:84 /約告訴我Sayfalar.php?Sayfa =繞到也。
但是,當我訪問http:// localhost:84/它給我403.14 - 禁止的錯誤。因爲我沒有使用index.php或default.php,我不想要它。
如何才能告訴'?Sayfalar.php Sayfa ='(Sayfa爲空)訪問到的http://本地主機:84/以及

回答

0

在Apache中,你會發現一個的index.php文件在htdocs,將默認網站設置爲xampp文件夾(默認情況下)。也許你必須在IIS中找到相同的情況。嘗試編輯默認網站到您的網站的目錄,也許你可以設置你綁定到其他端口(如你所願,它可以使用= 84)。祝你好運,它對我有用。 該代碼添加到web.config文件

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

注:爲Login.aspx就是一個例子。將其更改爲默認文檔。

+0

我沒有網站目錄問題。我只是試圖沒有得到403錯誤。相反,我想顯示'Sayfalar.php?Sayfa ='。有什麼辦法可以在web.config文件中做到這一點。 – traBolics 2014-09-26 02:12:20

+0

這是目錄列表問題。它被某種東西否定,或者被確認。如果你正在尋找一個在web.config文件中的錯誤嘗試添加代碼 <添加值= 「的Login.aspx」/> 2014-09-26 02:20:07