[英]Redirect from one url to another using 301 parmanent redirect rule in IIS
When user hit below Url: http://example.org/buy/parts/Vehicle/3/2012/5/76/6/1013/7/Toyota/8/Corolla当用户点击以下网址时: http : //example.org/buy/parts/Vehicle/3/2012/5/76/6/1013/7/Toyota/8/Corolla
It should redirect to http://example.org/buy/parts/Vehicle/2012/Toyota/Corolla它应该重定向到http://example.org/buy/parts/Vehicle/2012/Toyota/Corolla
Application code is in C# dotnet framework 3.5 I want to redirect Url using Redirect rule or from C# code side.应用程序代码在 C# dotnet framework 3.5 我想使用重定向规则或从 C# 代码端重定向 Url。
If you just want to redirect specific URL, then you could use IIS URL rewrite module redirect rule如果您只想重定向特定的 URL,那么您可以使用 IIS URL 重写模块重定向规则
</rule>
<rule name="redirect rule1" stopProcessing="true">
<match url="buy/parts/Vehicle/3/2012/5/76/6/1013/7/Toyota/8/Corolla" />
<action type="Redirect" url="buy/parts/Vehicle/2012/Toyota/Corolla" />
</rule>
https://docs.microsoft.com/en-us/iis/extensions/url-rewrite-module/creating-rewrite-rules-for-the-url-rewrite-module https://docs.microsoft.com/en-us/iis/extensions/url-rewrite-module/creating-rewrite-rules-for-the-url-rewrite-module
If you also want the URL like如果你还想要像这样的 URL
BASED on year,brand.基于年份,品牌。 You could use this rule
你可以使用这个规则
<rule name="redirect rule1" stopProcessing="true">
<match url="buy/parts/Vehicle/[^/]+/([^/]+)/[^/]+/[^/]+/[^/]+/[^/]+/[^/]+/([^/]+)/[^/]+/([^/]+)" />
<action type="Redirect" url="buy/parts/Vehicle/{R:1}/{R:2}/{R:3}" />
</rule>
can you detail your question? 你能详细说明你的问题吗? is asp.net mvc application ?
是ASP.NET MVC应用程序? see that if yes -> https://docs.microsoft.com/en-us/aspnet/mvc/overview/older-versions-1/controllers-and-routing/asp-net-mvc-routing-overview-cs
看到是否是-> https://docs.microsoft.com/zh-cn/aspnet/mvc/overview/older-versions-1/controllers-and-routing/asp-net-mvc-routing-overview-cs
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.