So I am using this current script below:
<script type="text/javascript">
if (window.location.href.indexOf('thevault') > -1) {
//window.location = 'http://thevault.co.uk/index.phtml?d=512060’;
window.location = '/index.phtml?d=512060';
} else {
//window.location = 'http://www.jths.co.uk/index.phtml?d=541300';
window.location = '/index.phtml?d=541300';
}
</script>
Which works fine, however I want to add another condition
if the url is: http://www.nationalforestteachingschool.co.uk , then go to this page:
https://thevault.jths.co.uk/index.phtml?d=550968
I have tried the else if command but can't seem to get it working, this needs to be in one continous script, any ideas??
Please have a look at W3Schools site.
You can chain many
else if
blocks if you need to..Consider using the Switch statement as well.
I made this small script to avoid having too many if / else statements, basically you define all your checks and redirects in the beginning and then let the script loop through them:
http://jsfiddle.net/XYaFg/1/
You have to uncomment the "window.location" row and comment out the "alert" stuff