Does anyone know how to redirect a visitor to a url that is input in the url? Ok, this isn't making much sense. What I want to do is something similar to what linkanon.com does except with my own domain instead of their's
Does anyone know how to redirect a visitor to a url that is input in the url? Ok, this isn't making much sense. What I want to do is something similar to what linkanon.com does except with my own domain instead of their's
If you know anything about php this should be a very simple script.
You can use the redirect function to do this and then use a simple GET to get the url.
If you want a script written for you I will do it for you for 20 points or something. PM me if you are interested.
I know how to redirect, but how do you take an input from the url? I don't actually know that much php. Only a little bit for wordpress purposes.If you can make it so that the input can come from the url, then I'll give you the 20 points.
The simplest solution (maybe not so "beauty" but works).
Let's take the url.
www.thelink.com/?r=www.google.com
inside the index.php we put the code
This code MUST be placed on the first position - before HTML tags, otherworks it will not work.<?
if(stristr($r, 'http') === FALSE) {
$r='Location: http://'.$r;
}
else {
$r='Location: '.$r;
}
header( $r ) ;
?>
If it still not works there might be "register_globals" set to OFF. In that case, before that code insert this:
Together it should work just fine. Some explonations:<?
if (!ini_get('register_globals')) {
$types_to_register = array(
'GET','POST',
'COOKIE','SESSION','SERVER'
);
foreach ($types_to_register as $type) {
if (@count(${'_' . $type}) > 0) {
extract(${'_' . $type}, EXTR_OVERWRITE);
}
}
}
?>
That "if..." statment determines the format of given URL - with or without trailing "http://". If there's no "http" it simply adds it.
I forgot... The construction "link.com/?r=someurl.com" should work, but in some (rare) cases it's necessary to put the file name between the path and the parameter (eg. link.com/index.php?r-someurl.com". It depends on server configuration...
Amazing, it definitely works. Now I can update my blog link exchanges with some lower rated PR sites. I think linking to all of them directly might hurt my SEO, so I'm choosing to keep some of the links internal.
Except it will not affect PR of the sites that you're linking to, because google will treat such link as an internal linkOriginally Posted by claire333
![]()
But the good site of it is that you can simply build "link stats" around this code - eg. how many times the link was clicked, who did it etc...
Bookmarks