Many times we meet situations where the current website/page should be redirected to another one. This is a great way to provide your visitors with the information they where looking for and prevents you from loosing your traffic.

1. Meta redirection
Place it in the <head> section </head>

<meta http-equiv=”refresh” content=”0; url=http://example.com/” />

2. JavaScript redirection
Place it in the <head> section </head>

<script language=”javascript”>
window.location.href = “http://example.com”
</script>

Not all users have JavaScript enabled, so you need to prepare a backup solution for them.
In this case you can add the below code too (in the <head> section:

<noscript><meta http-equiv=“refresh” content=“0; url=news-nojs.php”></noscript>

3. PHP redirection
Place it in the header section.

<?php header(“Location: http://example.com”, TRUE, 303); exit; ?>

2 COMMENTS

Leave a Reply