ASP.NET HTT predirect:重定向除一人外的所有页面 [英] ASP.NET httpRedirect : redirect all pages except one

查看:291
本文介绍了ASP.NET HTT predirect:重定向除一人外的所有页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用在web.config此code在我的网站上的一个文件夹中的所有页面重定向到根,因为我要永久结束本节。

I use this code in the web.config in one of the folders of my website to redirect all pages to the root because I want to close permanently this section.

<?xml version="1.0" encoding="utf-8"?>
<configuration>
 <location>
    <system.webServer>
      <httpRedirect enabled="true" destination="http://www.example.com/" httpResponseStatus="Permanent" />
    </system.webServer>
  </location>
</configuration>

但我需要作出例外:我不希望我的页面的Default.aspx要重定向。我该怎么做?

But I need to make an exception to this rule : I don't want my page "default.aspx" to be redirect. How can I do that?

感谢你在前进!

推荐答案

您可以通过以下方式添加通配符,重定向只有某些文件:

you can add a wildcard in the following manner, to redirect only certain files:

    <configuration>
       <system.webServer>
          <httpRedirect enabled="true" exactDestination="true" httpResponseStatus="Found">
             <add wildcard="*.php" destination="/default.htm" />
          </httpRedirect>
       </system.webServer>
    </configuration>

但我不知道如果你能否定这一点,所以它忽略某个特定文件。

But i'm not sure if you can negate that, so that it ignores a certain file.

这篇关于ASP.NET HTT predirect:重定向除一人外的所有页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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