From 534be03fdc52bdaeb48ffe89cb6aa042ad1890ad Mon Sep 17 00:00:00 2001 From: Derek Jones Date: Tue, 10 Feb 2009 18:47:47 +0000 Subject: changed redirect() to only force site_url() when the supplied URL doesn't start with an http protocol, allowing you to use the helper for external URLs. --- system/helpers/url_helper.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'system/helpers') diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php index 6c3bc837a..5be43300e 100644 --- a/system/helpers/url_helper.php +++ b/system/helpers/url_helper.php @@ -528,11 +528,16 @@ if ( ! function_exists('redirect')) { function redirect($uri = '', $method = 'location', $http_response_code = 302) { + if ( ! preg_match('#^https?://#i', $uri)) + { + $uri = site_url($uri); + } + switch($method) { - case 'refresh' : header("Refresh:0;url=".site_url($uri)); + case 'refresh' : header("Refresh:0;url=".$uri); break; - default : header("Location: ".site_url($uri), TRUE, $http_response_code); + default : header("Location: ".$uri, TRUE, $http_response_code); break; } exit; -- cgit v1.2.3-24-g4f1b