找不到尾部斜杠时,IIS7自动重写 [英] IIS7 auto rewrites when no trailing slash found

查看:193
本文介绍了找不到尾部斜杠时,IIS7自动重写的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我没有斜杠时,IIS7会自动进行重定向,如何解决此问题.

when I don't have a trailing slash IIS7 automatically does a redirect, how do I fix this..

所以 http://mydomain.com/deals 将会重定向到 http://mydomain.com/deals/

推荐答案

首先,您需要安装 URL重写模块.

然后创建如下规则:

<rule name="AddTrailingSlashRule" stopProcessing="true">
    <match url="(.*[^/])$"/>
    <conditions>
        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true"/>
        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true"/>
    </conditions>
    <action type="Redirect" url="{R:1}/" logRewrittenUrl="true"/>
</rule>

这篇关于找不到尾部斜杠时,IIS7自动重写的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆