URL Redirection from a html page to an .aspx page

家住魔仙堡 提交于 2019-12-11 11:27:46

问题


I have a requirement where i have to use url redirection in my legacy web page (basically its a complete static html page).

The requirement for me is to redirect the user everytime, from the static html page to a .aspx page

i.e 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)

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

I went through the following links, which talks mainly redirection w.r.t ASP.NET

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

However,

Since the pages are html. I presume by default not handled by the ASP.NET ISAPI filter

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

  2. Programmatically achieving redirection using Meta Refresh (although i have heard this method is highly discouraged)

Thanks in advance

VATSAG


回答1:


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.




回答2:


You can use the ISAPI Rewrite and let the IIS server redirect your .html page. Use the following rule:

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



回答3:


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

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. So search engines blacklist sites that use that meta refresh as belonging to spammers.



来源:https://stackoverflow.com/questions/13068519/url-redirection-from-a-html-page-to-an-aspx-page

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!