Redirecting a webpage

There is a very simple method of redirecting webpages in html. In the <head> element you simply need to add the <meta> tag <meta http-equiv="Refresh" content="0; URL=http://www.somedomain.com/page_to_redirect_to"> to the contents of your html between your <head></head> tags. Lets look at the tag in more detail, http-equiv="Refresh" tells the web browser to refresh the webpage with the following variables content="0; URL=http://www.somedomain.com/page_to_redirect_to". There are two variables in content seperated by a semi-colon. The first, in this case 0, tells the browser how long to wait in seconds before reloading the webpage. The second, in this case URL=http://www.somedomain.com/page_to_redirect_to, gives the browser the url to redirect too. So for the above we have told the browser to load the page http://www.somedomain.com/page_to_redirect_to immediately. If we had set the first variable to 60 then the browser would wait 60 seconds before loading http://www.somedomain.com/page_to_redirect_to.

So say you want to redirect your main website at http://www.mtheory.co.uk/name straight to your blog then you would replace the code in your index.html file in your Website folder with the following:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
	<meta http-equiv="Refresh" content="0; URL=http://www.mtheory.co.uk/name/wordpress/">
        <title>My Blog</title>
	</head>
	<body>
	<!--<p>This page should automatically redirect you to
       <a href="http://www.mtheory.co.uk/name/wordpress/">
       http://www.mtheory.co.uk/name/wordpress/</a></p>-->
	</body>
</html>

You should replace the name parts of the urls with your name which is the part before the @mtheory.co.uk in your email address. The paragraph in the <body> has been commented out with <!-- -->. You may want to remove the comments so that the browser displays a link that people can click on if for some reason their browser fails to redirect them. You may also wish to change the title from My Blog to anything else you wish.

Leave a Reply

Your email address will not be published. Required fields are marked *