summaryrefslogtreecommitdiffstats
path: root/system/helpers/url_helper.php
diff options
context:
space:
mode:
authorDerek Jones <derek.jones@ellislab.com>2009-02-10 19:47:47 +0100
committerDerek Jones <derek.jones@ellislab.com>2009-02-10 19:47:47 +0100
commit534be03fdc52bdaeb48ffe89cb6aa042ad1890ad (patch)
tree6139d88256dc80871c345a750f6d2d4f9b5510e5 /system/helpers/url_helper.php
parentf0bcb3c9c41ba4a7236908e2997eb56109ad9592 (diff)
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.
Diffstat (limited to 'system/helpers/url_helper.php')
-rw-r--r--system/helpers/url_helper.php9
1 files changed, 7 insertions, 2 deletions
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;