2017-02-22 85 views
0

我想RewriteURL經典ASP在IIS 10經典ASP URL重寫在IIS 10

前)domain.com/login.asp - > domain.com/login/

還有使用方法重寫規則。

我對此不確定。

請幫助我..

這是我的web.config文件設置..

謝謝。

回答

0

調整您的原始web.config - 試試這個。如果你有RDP訪問你的服務器,你也可以在IIS管理器中使用URL Rewrite工具 - 這將寫入到web.config

<configuration> 
    <system.webServer> 
     <httpErrors errorMode="Detailed" /> 
     <defaultDocument enabled="true"> 
      <files> 
       <add value="default.asp" /> 
       <add value="index.asp" /> 
       <add value="login.asp" /> 
      </files> 
     </defaultDocument> 
     <rewrite> 
      <rules> 
       <rule name="Login" stopProcessing="true"> 
       <match url="^login$"/> 
        <conditions> 
         <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true"/> 
         <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true"/> 
        </conditions> 
        <action type="Rewrite" url="login.asp"/> 
       </rule> 
      </rules> 
     </rewrite> 
    </system.webServer> 
</configuration> 
+0

謝謝你的回覆。 我嘗試應用此代碼。 但發生以下錯誤: HTTP錯誤403.14 - 禁止 我該怎麼辦? T.T. –

+0

這就是我認爲的目錄瀏覽禁止消息。再次查看我的代碼,它會將「domain.com/login」重寫爲「domain.com/login.asp」。如果你想在最後包含「/」,那麼你需要將相關行改爲''。另外,您的網站中是否有名爲「登錄」的子文件夾?如果你這樣做可能會導致衝突。如果是這種情況,可以將login.asp文件移動到登錄文件夾。您可以指定多個默認文檔,我已經修改了我的答案以演示此 – John

+0

謝謝。我的所有問題都已解決。 –