2017-02-22 126 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

谢谢。我的所有问题都已解决。 –