简体   繁体   English

URL重定向从html页面到.aspx页面

[英]URL Redirection from a html page to an .aspx page

I have a requirement where i have to use url redirection in my legacy web page (basically its a complete static html page). 我有一个要求,我必须在我的遗留网页中使用网址重定向(基本上它是一个完整的静态HTML页面)。

The requirement for me is to redirect the user everytime, from the static html page to a .aspx page 对我的要求是每次都将用户重定向,从静态html页面到.aspx页面

ie if my earlier page were found to be at 即如果我的早期页面被发现在

http://web.vatsag.com/app/en/downloadsite.htm

then i have to redirect to the following page (.aspx) 然后我必须重定向到以下页面(.aspx)

http://web.vatsag.com/app/newdownloadsite.aspx

I went through the following links, which talks mainly redirection wrt ASP.NET 我浏览了以下链接,主要讨论ASP.NET的重定向

http://www.codeproject.com/Articles/2538/URL-Rewriting-with-ASP-NET http://www.codeproject.com/Articles/2538/URL-Rewriting-with-ASP-NET

However, 然而,

Since the pages are html. 由于页面是html。 I presume by default not handled by the ASP.NET ISAPI filter 我假设默认情况下不由ASP.NET ISAPI过滤器处理

Can anyone help me in achieving the same using any of the alternatives specified below ? 任何人都可以使用下面指定的任何替代方案帮助我实现相同的目标吗?

  1. Any particular setting that could be done on the IIS Side 可以在IIS端完成的任何特定设置

  2. Programmatically achieving redirection using Meta Refresh (although i have heard this method is highly discouraged) 使用Meta Refresh以编程方式实现重定向(尽管我非常不鼓励这种方法)

Thanks in advance 提前致谢

VATSAG VATSAG

between the head tags, put this code. 在头部标签之间,放置此代码。

<head>       
    <meta http-equiv="refresh" content="2;URL='http://web.vatsag.com/app/newdownloadsite.aspx'" />    
  </head> 

That will redirect after 2 seconds to http://web.vatsag.com/app/newdownloadsite.aspx 这将在2秒后重定向到http://web.vatsag.com/app/newdownloadsite.aspx

Content= Number of seconds to refresh URL = url path to redirect to The reason meta refreshes are discouraged is because spammers use them to redirect users from shell sites that have lots of keywords to non-legitimate sites. 内容=刷新URL的秒数=重定向到的url路径不鼓励元刷新的原因是垃圾邮件制造者使用它们将用户从具有大量关键字的shell网站重定向到非合法网站。 So search engines blacklist sites that use that meta refresh as belonging to spammers. 因此,搜索引擎将使用该元刷新的网站列入黑名单,因为它们属于垃

There are different options of doing so described here . 也有这样描述不同的选择这里 You can basically add a meta tag to refresh the page after a second to aspx page or use javascript. 你可以基本上添加一个元标记,在第二个到aspx页面之后刷新页面或使用javascript。

You can use the ISAPI Rewrite and let the IIS server redirect your .html page. 您可以使用ISAPI重写并让IIS服务器重定向您的.html页面。 Use the following rule: 使用以下规则:

RewriteRule ^app/en/downloadsite.htm$ /app/newdownloadsite.aspx [NC,R=301,L]

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

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