ASP.NET httpRedirect:重定向所有页面,除了一个
发布时间:2020-12-16 00:41:55 所属栏目:asp.Net 来源:网络整理
导读:我使用这个代码在web.config在我的网站的一个文件夹中的所有页面重定向到根,因为我想永久关闭这一节。 ?xml version="1.0" encoding="utf-8"?configuration location system.webServer httpRedirect enabled="true" destination="http://www.example.com/"
我使用这个代码在web.config在我的网站的一个文件夹中的所有页面重定向到根,因为我想永久关闭这一节。
<?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”被重定向。我怎样才能做到这一点? 解决方法
您可以按以下方式添加通配符,仅重定向某些文件:
<configuration> <system.webServer> <httpRedirect enabled="true" exactDestination="true" httpResponseStatus="Found"> <add wildcard="*.php" destination="/default.htm" /> </httpRedirect> </system.webServer> </configuration> 但是我不知道你是否可以否定这一点,所以它忽略了某个文件。 (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容
- asp.net-mvc – ASP.NET MVC3:调试和发布应用程序设置不工
- .net – CQRS EventSourcing可扩展性
- 使用ASP.NET MVC和JQuery表单插件/文件上传检测IsAjaxReque
- asp.net – 部署在Visual Studio中正常运行,无法使用MSDepl
- 具有嵌套列表的ASP.NET MVC DefaultModelBinder
- asp.net:response.redirect无法正常工作
- asp.net – 使用jetBrains dotTrace检测W3WP CPU问题
- ASP.Net的最佳免费文件管理器
- .net – 我应该在HttpCookie.Expires和HttpCachePolicy.Set
- asp.net-mvc – 在Mvc中验证DateFormat
推荐文章
站长推荐
- asp.net – 锚标记href中的eval
- asp.net-mvc – Ninject.Web.Common抛出Activati
- asp.net-mvc – 不要在ASP .NET MVC 4 BundleCon
- asp.net-mvc – MVC3将@model传递给局部视图
- 适用于ASP.NET的SaaS入门套件,涵盖订阅,计费等
- asp.net – 在现有系统上重构可测试性
- asp.net-mvc – 如何在LINQ中查询列表
- asp.net – 设置值时页面移位 – 我的代码或最新
- asp.net-core – Asp.net vNext中的bindingRedir
- asp-classic – 哪里可以存储经典ASP的连接字符串
热点阅读