Redirection to a different Page

From Webmaster-A Webmaster Resources

Ultimate Page of Redirection Techniques

This page has been designed to be the webs ultimate resource on redirection techniques. If you know of some useful methods not shown here please let us know. We cover PHP redirections, ASP redirections, Server Side Redirection (301 Redirects) Flash redirection and Javascript redirection including a very sneaky Iframe based redirection trick.

Browser Side Redirection using HTML

In html you can use the meta-refresh tag to redirect a page immediately or after a period of time. A word of warning on this - some search engines will penalise pages that use this page redirection technique with short (less than 300 seconds) delays since they will regard this as a cloaking attempt (human users redirected too quickly to read the page). It can be useful to however to redirect to a different site you own or directly to a sponsors page (with your referral code!) after 350 seconds. The idea being that a surfer has your site in a stack of windows or tabs and as he closes them he will stop at the new page and look at it.

Here is an example of a meta refresh redirect statement with a 350 second delay:

This when placed between the head and /head tags of a page would redirect to disney after a 350 second delay. To redirect instantly you simply set the delay to zero. To see what a 10 second and an instant meta-refresh redirection looks like then you can use the buttons below!

   


Browser Side Redirection using Javascript

You can also use javascript to redirect to other pages. This is useful because you can make the redirection condition which is how drop-down navigation menus are created. Of course you can also make this a non-conditional redirect which is a technique often use to cloak content, the search engine will read the page because it does not execute javascript but users will be instantly redirected. Note that this javascript method is rather more instant than 'instant' meta-refresh redirection if the code is placed in the header because meta-refresh waits for the page to load first.

Nowadays the search engines know to look for redirection in javascript so either encrypt the script or load it from a remote file (with acess denied in robots.txt) if you plan on cloaking any content. Here is a simple javascript instant redirect statement:

To see this page with an instant javascript redirect (in the page head section) use this button:


Browser Side Redirection using Flash

If you make your own flash movies or own a copy of flash this is pretty easy. For an instant redirect make a flash movie with one frame that has a single transparent area in it, then paste the code below into the actionscript pane for that frame. If you want to redirect after a period of time then make a movie of the appropriate length and paste the code into the actionscript pane of the last frame.


Hidden Browser Side Redirection using Iframe and Javascript

For those who are paranoid about search engines finding their pages are redirected this is a good method. Simply put an iframe in the page you want to redirect from then in the source attribute of the iframe put the url of the page you wish to redirect to.

In the new page you are redirecting to add a javascript framebreaker to its html as below:

So what happens is the browser loads the new page into the iframe, executes that pages framebreaker and displays the new page instead of the one you were originally loading...Bingo! Rapid Javascript redirect with no tell tale redirection code. Sneaky huh? To try this on this page press the button below:


Server side page redirection using PHP

This is useful when you want to redirect to a different page depending on the outcome of a script. For example this script will redirect to a different page depending on the day of the week:

The script will redirect to a joke page on a sunday, political news on a monday and so on. Note that you MUST call the fuction before any text or html is sent to the browser. If you call it after the redirect will fail with an error message.

To try it out use this button:

Feel free to use any of our PHP code snippets on your site. It has been placed in a text box to make cut and paste easier. A link back to www.webmaster-a.com would be appreciated!


Page Redirection from any point in a PHP Script

Oh yes you can - if its too awkward to redirect before your script sends headers then here is a way of doing a PHP Redirect after the Header which everybody said could not be done but with a bit of lateral thinking its easy!


Server Side Redirection using .htaccess 301 on Unix servers

Result Code 301 is the only way to redirect to a new page which is properly supported by search engines. It is often known as permanent redirect. Google will transfer not only all traffic but also any pagerank to the new page.

Dot htaccess files are simple text files called '.htaccess' that contain instructions for the server on your site. You can have one file (in the document root directory) for the whole site or one in every directory where it is needed. If you already have a .htacess file in your directory then simply add any redirects to the top of the file (before any other code).

Below are some useful redirect techniques, if you want more information then try the Official .htaccess files documentation. Please note that .htaccess only works if you are on a Unix server. See the next topic on this page for redirecting on a windows server.

To move a single page you can use this line in your .htaccess file:

Alternatively you can move an entire site by catching traffic to any page on a disused site and redirecting it to a new site entirely:


Server Side Redirection using ASP and ASP.net on windows servers

Result Code 301 is the only way to redirect to a new page which is properly supported by search engines. It is often known as permanent redirect. Google will transfer not only all traffic but also any pagerank to the new page.

Place the following code above your <html> tag or <!DOCTYPE> tag if you have one on the page you wish to redirect from:

Of course if you are using .asp.net then the code will be different:


Useful Pages

Social Bookmarking:



Page redirection Referrers

bookmark hit
www.google.co.uz
www.google.co.in
www.google.com
...
vidvain.com
ozinengland.com
www.youtube.com
www.google.co.uk
ecashhyip.com
www.google.com.ph
www.google.nl
home.suddenlink.net
...
www.google.com.sg
...
www.google.be
...
www.google.co.ma
www.google.ro
www.google.ca
www.google.co.za
...
www.google.com.au
www.twotsi.com
www.google.co.id
...
...
...
www.google.co.il
www.google.ps
www.google.se
www.google.lk
www.google.hu
www.google.ie
...
...
www.simptex.com
www.google.it
...
...
www.google.com.co
...
www.google.dk
...

This list of people who link to this Page redirection techniques page is automagically maintained. Link to us, send traffic, and get listed. Simple.