IIS URL重写模块的URL转换为小写 [英] IIS URL rewrite module url's to lowercase

查看:958
本文介绍了IIS URL重写模块的URL转换为小写的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为了更好的SEO,我们使用URL重写转换所有URL的为小写。我把这个作为<一提到href=\"http://dotnetplace.com/post/IIS-7-URL-Rewrite-Module-20-%E2%80%93-Convert-to-lowercase-URL.aspx\"相对=nofollow>这个 <击>下的的文章。

一切都从URL角度看做工精细,但我们看到,当我们在提琴手检查很多301重定向。
它看起来像图像,JavaScript,CSS,jQuery的Ajax调用,一切都越来越转换成小写。
我试图删除并希望只改写ASPX扩展,无扩展名的URL。我试图围绕matchurl发挥没有任何成功。任何帮助或指导方针将高度appricated。

感谢

编辑:
我目前的规则是

 &LT;规则与GT;    &LT; RuleName中=LowerCaseRule1patternSyntax =精确匹配stopProcessing =真&GT;
      &LT; matchurl =[A-Z]IGNORECASE =FALSE/&GT;
      &LT;操作类型=重定向URL ={ToLower将:{URL}}/&GT;
    &LT; /规则&GT;
  &LT; /规则&GT;


解决方案

您也许可以使用的东西如下:

 &LT;规则名称=LowerCaseRule1stopProcessing =真&GT;
    &LT;匹配URL =[A-Z]IGNORECASE =FALSE/&GT;
    &lt;作用TYPE =重定向URL ={ToLower将:{URL}}/&GT;
    &LT;条件logicalGrouping =MatchAny&GT;
        &LT;添加输入={} REQUEST_FILENAME模式=\\ $的aspx/&GT;
        &LT;添加输入={} REQUEST_FILENAME模式=\\。否定=TRUE/&GT;
    &所述; /条件&gt;
&LT; /规则&GT;

该规则将被触发仅当条件之一为真:


  • 如果请求的路径(文件名)与的.aspx 结束第一个检查。

  • 第二个检查是否所请求的路径(文件名)不包含 (因此不具有扩展名)

For better SEO we are using URL rewrite to convert all the URL's to lowercase. I set this one as mentioned in this the below article.

Everything is working fine from URL perspective, but we see lot of 301 redirects when we check in fiddler. It looks like the images, javascript, css, jquery ajax calls and everything is getting converted into lower case. I am trying to remove that and want to rewrite only aspx extension and no extension urls. I tried to play around the matchurl without any success. Any help or guidelines will be highly appricated.

Thanks

Edit: My Current rule is

 <rules>

    <rulename="LowerCaseRule1"patternSyntax="ExactMatch"stopProcessing="true">
      <matchurl="[A-Z]"ignoreCase="false"/>
      <actiontype="Redirect"url="{ToLower:{URL}}"/>
    </rule>
  </rules>

解决方案

You could probably use something as follow:

<rule name="LowerCaseRule1" stopProcessing="true">
    <match url="[A-Z]" ignoreCase="false" />
    <action type="Redirect" url="{ToLower:{URL}}" />
    <conditions logicalGrouping="MatchAny">
        <add input="{REQUEST_FILENAME}" pattern="\.aspx$" />
        <add input="{REQUEST_FILENAME}" pattern="\." negate="true" />
    </conditions>
</rule>

The rule will be triggered only if one of the condition is true:

  • The first one checks if the requested path (filename) ends with .aspx.
  • The second one checks if the if the requested path (filename) doesn't contain a . (so doesn't have an extension)

这篇关于IIS URL重写模块的URL转换为小写的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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