Welcome to WebmasterWorld Guest from 54.163.100.58

Forum Moderators: coopster & jatar k

code detect broken link and redirect

code detect broken link

   
1:09 pm on Nov 3, 2011 (gmt 0)

10+ Year Member



I need help
1. What is code detect links and redirect new link
2 . What is code detect image no longer available and display a new image
.thank
4:38 pm on Nov 3, 2011 (gmt 0)

WebmasterWorld Senior Member rocknbil is a WebmasterWorld Top Contributor of All Time 10+ Year Member



Well, I don't have code but there's a number of ways to do it . . .

1. What is code detect links and redirect new link


You could pipe it through a script and read the headers, if you get a 404, redirect.

2 . What is code detect image no longer available and display a new image


If the file is on your server, easy:

if (!is_file($_SERVER['DOCUMENT_ROOT'] . "/$img")) {
$img = $default_img;
}

If it's a remote image, I'd use the same method as in #1.
 

Featured Threads

My Threads

Hot Threads This Week

Hot Threads This Month