Hi do any of you no a script that will redirect a list of url's to a difrent page if it could be made of php plz thanks.
Nop sorry let me tell you more i want to hav a list of banned urls to a script and when some 1 comes from that site they will get redirected to a page i want if that helps more.
<?php $sendTo = 'http://www.mysite.com/you/are/banned.php'; $blackList = array( 'badsite.com', 'badsubdomain.goodsite.com', 'goodsite.com/baddir', 'goodsite.com/gooddir/badscript.php' ); if ( ! empty($_SERVER['HTTP_REFERER'] ) { foreach ( $blackList as $url ) { if ( strpos($_SERVER['HTTP_REFERER'],$url) ) { header('Location: ' . $sendTo); } } } ?> PHP: That sort of thing? (untested)
Hi i get this error Parse error: syntax error, unexpected '{' in /home/****/public_html/****/**** on line 10
Why not try mod_rewrite via .htaccess instead? Do it this way: RewriteEngine On RewriteCond %{HTTP_REFERER} ^http://(www\.)?banned1.com.*$ [NC,OR] RewriteCond %{HTTP_REFERER} ^http://(www\.)?banned2.net.*$ [NC,OR] RewriteCond %{HTTP_REFERER} ^http://(www\.)?banned3.info*$ [NC] RewriteRule \.*$ http://my-site.com/banned.php[R,L] Code (markup):
should i put this in the htaccess in the folder were i want the sites to be redirected from like lets lay they was coming to a link dump page and i wanted to redrect them from www.doamin.com/linkdump/index.php too www.domain.com/youarebanned.php for that would i put it in the linkdump folder is that right. thanks for the help any ways.
Whoops, my fault. Forgot a closing ). Corrected version is below, or just use the rewrites above. <?php $sendTo = 'http://www.mysite.com/you/are/banned.php'; $blackList = array( 'badsite.com', 'badsubdomain.goodsite.com', 'goodsite.com/baddir', 'goodsite.com/gooddir/badscript.php' ); if ( ! empty($_SERVER['HTTP_REFERER']) ) { foreach ( $blackList as $url ) { if ( strpos($_SERVER['HTTP_REFERER'],$url) ) { header('Location: ' . $sendTo); } } } ?> PHP: EDIT: Yes, the .htaccess would go in your linkdump folder - then any requests to the linkdump dir (site.com/linkdir, site.com/linkdir/page.php, site.com/linkdir/anotherdir/script.php) will all be checked and redirected if they come from a banned site.
Now i get : Parse error: syntax error, unexpected T_VARIABLE in /home/****/public_html/****/**** on line 1 Thanks for all your help.