How can PHP be used to check if a specific webpage is reachable and redirect to another if it is not?

To check if a specific webpage is reachable using PHP, you can use the `get_headers()` function to retrieve the headers of the webpage. If the headers are successfully retrieved, it means the webpage is reachable. If not, you can redirect the user to another webpage using the `header()` function.

$url = 'http://www.example.com';
$headers = @get_headers($url);

if($headers && strpos($headers[0], '200')) {
    // Webpage is reachable
    header('Location: http://www.example.com/success_page.php');
} else {
    // Webpage is not reachable
    header('Location: http://www.example.com/error_page.php');
}