Force redirect script - all browsers

the_demon

Elite Member
Joined
Nov 23, 2008
Messages
3,220
Reaction score
1,512
Ok, I see so many of you guys in need of help and so many crappy meta resfresh scripts out there...

What many of you do not know is:
Chrome blocks PHP Location redirects
Firefox can easily block meta refresh
Various plugins can block javascript redirects

Here's my solution that kicks the browsers @$$!

Code:
<?php
header( 'http://mydomain.com/mywebpage.php' );
?>
<meta http-equiv="refresh" content="0;url=http://mydomain.com/mywebpage.php" />
<script type="text/javascript">
window.location = "http://mydomain.com/mywebpage.php"
</script>

For people who need double refresh just copy this code and set the first page to redirect to page B (on your domain) Then bounce it out to final destination. You can of course use refer checks, magic key checks, browser checks, ip checks, etc. It all depends on what your purpose is.

REP or Thanks appreciated ;)
 
Last edited:
Chrome accepts a Location as long as a status code is sent in conjunction.

-aReJay
 
I've had issues with chrome and PHP based redirects... sometimes it just freezes up and yields a blank white page. Also, people can turn off meta refresh in their browser so it's best to use all 3 methods to make sure the redirect happens ;) :)
 
For people who need double refresh just copy this code and set the first page to redirect to page B (on your domain) Then bounce it out to final destination. You can of course use refer checks, magic key checks, browser checks, ip checks, etc. It all depends on what your purpose is.

REP or Thanks appreciated ;)


Hey this is very appreciated. I just tried this and am still getting the referrer showing up in chrOme.

Any additional hints or tips, maybe there's something I'm not doing correctly?
 
For people who need double refresh just copy this code and set the first page to redirect to page B (on your domain)


To be more specific, maybe all I need is further help with how to edit the code to do the redirect to page B.

Right now I have an "index.php / index2.php" setup.
 
I've got a question about this script:

Is it possible to fill it in so that the redirect would come from
Code:
hxxp://w w w.domain.com
Instead of
Code:
hxxp://w w w.domain.com/file.php
Any help is really appreciated...
 
Yes, I would call this "flash backing"

http://www.site.com/page.php --> redirect to: http://www.domain.com/?key=push_that_guy_forward

Code:
<?php
$key = $_GET['key'];
if ($key=="push_that_guy_forward")
{
header( 'http://site-to-goto.com/mywebpage.php' );
echo"<meta http-equiv="refresh" content="0;url=http://site-to-goto.com/mywebpage.php" />
<script type="text/javascript">
window.location = "http://site-to-goto.com/mywebpage.php"
</script>";
}
else{
echo ""; //do nothing
}
?>


Now, if you want to take this a step further.

1. redirect to domain.com/?key=something
2. drop a cookie
3. refresh page domain.com
4. if cookie = present load FORCE REDIRECT

This would ensure that:
a) no one (your cpa manager for example) gets the "unlock key"
B) the refer should show up exactly as http://WWW.MYSITE.COM
C) no key trailing in cpa company analytics or whatever...

Try it out first just to make sure. If the refer is still showing with the key use a double refresh.
If cookie present = reload once
on reload #2 check cookie, if count =1 refresh again
on reload if get cookie counter
if counter= 2 PUSH FORWARD

*** OPTIONAL ADVANCED OPERATION ***
1. use session instead of cookie to be more stealthy
2. will work for users who don't support or whom block cookies
3. use session & cookie for double assurance that you get the desired result

*** PISS YOUR CPA MANAGER & COMPETITORS OFF ***
- use a mutating key

-->if traffic_source=$mysecretplace
--> Generate 1 time key, write key to database & log ip

... now your competitor who was redirected goes back to take a sneak peak at your code

(check database)
if $user_ip = $blocked_ip
--> don't load page
if key = used
--> don't load page
:hmpf: Huh, guess the page doesn't work. :(
 
Last edited:
Back
Top