简体   繁体   English

IIS7上经典ASP中的服务器端重定向

[英]server side redirect in classic ASP on IIS7

I'm trying to implement a simple 301 redirect from mydomain.com/page1.asp to mydomain.com/page2.asp . 我正在尝试实现从mydomain.com/page1.aspmydomain.com/page2.asp的简单301 redirect These are dynamically generated product pages of an ecommerce store, so they don't physically exist as files. 这些是电子商务商店的动态生成的产品页面,因此它们实际上不作为文件存在。

In Apache it's simple to do with .htaccess but all I found are ways to redirect static pages, that actually exist on the server, such as placing the code below in at the top of the existent file: 在Apache中,使用.htaccess很简单,但是我发现的是重定向服务器上实际存在的静态页面的方法,例如将下面的代码放在现有文件的顶部:

<%@LANGUAGE="VBSCRIPT"%>
<%
' Redirect to the new location with the correct 301 Moved Permanently status
Response.Status = "301 Moved Permanently"
Response.AddHeader "Location", "http://www.example.com/new-page.php"
%>

Is there a way to redirect a dynamically generated page in IIS7 using classic asp? 有没有办法使用经典的ASP重定向IIS7中动态生成的页面?

UPDATE UPDATE

Based on the comments received, I need an URL rewrite module. 根据收到的评论,我需要一个URL重写模块。 @ZippyV suggested this one @ZippyV建议了这个

You want to rewrite your URL requests instead of redirecting them. 您想重写 URL请求,而不是重定向它们。

IIS has a URL Rewrite module which you can download here . IIS具有URL重写模块,您可以在此处下载 Another nice feature is that it can transform your outgoing html too. 另一个不错的功能是它也可以转换传出的html。

More articles on how to use the IIS URL Rewrite Module: http://www.iis.net/learn/extensions/url-rewrite-module 有关如何使用IIS URL重写模块的更多文章: http : //www.iis.net/learn/extensions/url-rewrite-module

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM