Top

Simple Redirect


Javascript Code
+ 0 likes
Please Register to submit score.
Bookmark and Share
Average Score  0.0 (of 0 scores)
Date Added  Jul 01, 2008
Last Updated  Jul 01, 2008

Introduction

Simple redirect, if you go to URL "REDIRECT FROM", you will be redirected to "REDIRECT TO".

For example, if I move domain name, I could put in the homepage of my old domain (e.g. www.google.com) this to redirect to my new one, hawkee:

Quote:
<script type="text/javascript">
var p=location.href;
var s="http://www.google.com/";
if (p==s) {
window.location = "http://www.hawkee.com/";
}
</script>


When a user goes to www.google.com, they are redirected to www.hawkee.com
Very simple I know, I just needed it recently, and it's reasonably useful.

Usage Instructions:
Replace:
REDIRECT FROM (to the URL to be redirected from)
REDIRECT TO (to the URL to be redirected to)
and then place in <head></head>

Grab the Code

<script type="text/javascript">
var p=location.href;
var s="REDIRECT FROM";
if (p==s) {
window.location = "REDIRECT TO";
}
</script>

Comments

  (4)  RSS
markusPHP
Comments: 10
 
Javascript Snippet:  Simple Redirect
Posted on Jul 19, 2008 4:55 pm
Jeez, these are SIMPLE snippets.
vaseline28
Comments: 162
 
Javascript Snippet:  Simple Redirect
Posted on Aug 19, 2008 2:40 pm
Yes, this was the first Javascript I attempted, I've now gone on to slightly more advanced stuff.
PATX
Comments: 389
 
Javascript Snippet:  Simple Redirect
Posted on Apr 26, 2009 4:36 pm
mine does not wok.... i have it on http://patx44.webs.com/svn/ but when i got to it it does not redirect to http://patx44.webs.com as it should anyhelp?
vaseline28
Comments: 162
 
Javascript Snippet:  Simple Redirect
Posted on May 5, 2009 10:17 am
Following your link, I get a "Page not Found"

Commenting Options

Register or Login to Hawkee.com or use your Facebook or Twitter account by clicking the corresponding button below.

  
Bottom