Tutorials
CSS
Web Design
XHTML
Javascript
PHP

Web Design Tutorials
Embedding fonts
Page Redirection
Access Hard Drives
Avoiding Spam Mail
Editable Page Content
Copyright Basics
File Include
Mailto Links
Maintain Framesets
Show the Hard Drive
Link Status Description


More information

Web Design Tutorials
Redirecting a Page

How to automatically redirect a page to another address.
This simple guide shows you two ways of redirecting a web page to a different web page.



Method 1.::
This first example is useful if you want to inform your visitor that you have moved.

Into the HEAD section of your page type:

<meta http-equiv="Refresh" content="5;url=http://www.your_new_address.something">

And then into the BODY of your document put:

"My_old_web_address" has moved to "My_new_web_address"
If your browser does not automatically redirect you in 5 seconds, click <a href="http://my_new_web_address">here</a> to go to the new site.

You don't need to display a message and can just redirect quickly by setting the time to zero, but it's polite to inform your visitor!



Method 2.::
This second example is a handy redirection script for those who don't want the page to load first (i.e. instant redirection). You simply need to add the following code before your own HTML code:

<script language="Javascript"> document.location = "http://www.url.com/new_html_file.html"; </script>

So this code will execute the above code before compiling the webpage, it is useful for when one doesn't feel the need to inform the user of the redirection taking place.

Method 3.::
The third example is similar the script above, but is handy if you have a number of domain names (for whatever reason) and want all names to point to the same domain.

Just add this to the top of your document:

<script language="JavaScript">
<!--
if( -1 == location.href.
toLowerCase().
indexOf('your-domain.fi') )
{
location.href = 'http://your-domain.fi';
}
// -->
</script>

The above code will check if 'your-domain.fi' is part of the code and if not will immediately redirect to 'http://your-domain.fi'


Discuss this in the Forum  

Search HeaphyDesigns



Stored Pages



Change Site Style
Select a style for the site:




More information