Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
tree: a08ee7ed6e
Fetching contributors…

Cannot retrieve contributors at this time

executable file 13 lines (12 sloc) 0.32 kB
<?php
/*
Template Name: Redirect
*/
if (have_posts()) {
the_post();
$pattern = '@((https?://)?([-\w]+\.[-\w\.]+)+\w(:\d+)?(/([~-\w/_\.]*(\?\S+)?)?)*)@';
preg_match($pattern, get_the_excerpt(), $matches);
if ($matches[0]) header('Location:'.$matches[0]);
else echo 'Enter a URL into your page body text.';
}
?>
Jump to Line
Something went wrong with that request. Please try again.