Redirect traffic to another web page

by Rekha 2010-02-09 14:56:09

HTML Meta Rrefresh:
<meta http-equiv="refresh" content="0;url="/>

This technique will work in any HTML, and causes the browser to instantly load the site specified after url=. To introduce a delay, increase the number after content=; Typing a 5 would mean 5 seconds before redirection.

Apache Redirect:
You can type the following into a .htaccess file to send anything matching the first URI value to the second URL:
Redirect /path-to-redirect

This would reroute, for example, to

PHP HTTP Header Redirect
In any PHP script, before actual HTML output has started, you can use the header() function to insert a location header, instantly redirecting the browser:

Apache mod_rewrite Redirect
This is the most difficult but powerful of these four methods. In the example below, with code living in a .htaccess file, any traffic will redirect to Your imagination and the documentation above can produce other endless possibilities.
RewriteEngine On
RewriteRule .* [R]

Tagged in:


You must LOGIN to add comments