Help with code

workoutsforteens

Junior Member
Joined
Nov 28, 2011
Messages
170
Reaction score
139
Hello BHW, I was wondering if anyone knew of a redirect code that would randomly redirect to multiple web addresses you select.

For example the first visitor would be redirected to my blog
The second would be directed to my youtube video
And the third would be directed to an article I wrote.

Anyone know of some code that'll do that?

Thanks
 
I want my blogger blog to redirect to random pages that I choose.

And yes PHP
 
It can be done this way:
PHP:
<?php
$urls=array('hXXp://google.com', 'hXXp://facebook.com', 'hXXp://twitter.com'); // XX->tt cuz I can't post urls
header('HTTP/1.1 301 Moved Permanently');
header('Location: '.$urls[rand(0, count($urls)-1)]);
?>
 
Any errors/warnings shows?
If any, try
PHP:
<?php
ob_start();
$urls=array('hXXp://google.com', 'hXXp://facebook.com', 'hXXp://twitter.com'); // XX->tt cuz I can't post urls 
header('HTTP/1.1 301 Moved Permanently'); 
header('Location: '.$urls[rand(0, count($urls)-1)]);
ob_end_flush();
?>
 
no it doesn't say error or anything... but i check to see if its redirecting it doesnt. and then i go back to see if the code is still in place and its gone. and thats weird cuz it said "saved" when i clicked save template

This is true for both codes
 
I'm not familiar with Blogger platform so I can't help you, sorry.
 
I found it!


<script type="text/javascript">

var urls = new Array("http://www.url1.com/", "http://www.url2.com/");

function redirect()
{
window.location = urls[Math.floor(urls.length*Math.random())];
}

var temp = setInterval("redirect()", 3000);

</script>
 
You mean someone will be redirected if they land on your blogspot?

Not worth it bro. I've tried this a lot of times. It does work but somehow G is good at detecting when you start sending/receiving mass amt of traffic to the blogspot.
 
Back
Top