I was asked the other day how to perform an HTML redirect and thought I'd share it. I know it's quite a simple thing, but as they say on Who Wants To Be A Millionaire, the question's only easy if you know the answer!
<title>Your Page Title</title>
<meta content="0;url=http://www.domain-name-to-redirect-to.com" http-equiv="REFRESH"></meta>
Your optional text here.
The first line that we're interested in is, <meta content="0;url=http://www.domain-name-to-redirect-to.com" http-equiv="REFRESH"></meta>. This will redirect the user to the appropriate website after 0 seconds. You can make the browser redirect as short or as long as you wish.
Finally, in the BODY tag, you can enter optional text which you can display to the user, informing them, perhaps, that you are redirecting them.
Finally, in the BODY tag, you can enter optional text which you can display to the user, informing them, perhaps, that you are redirecting them.
The HTML redirect has a further application; I frequently write websites for customers who sign up for hosting packages where the control panel does not allow the MIME types to be altered or added to. So if someone accidentally lands on www.website-name.com, your files will be displayed (.aspx, .aspx.cs...). If you really want them to go to www.website-name.com/Login.aspx, you can write a redirect page. First, find out from the hosting provider the default MIME types and then create a file, using one of the names provided, copy the above code, and you have your own redirect to www.website-name.com/Login.aspx!