Commits

Derek Jones committed 3a85779

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.

Comments (0)

Files changed (2)

system/helpers/url_helper.php

 {
 	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;

user_guide/changelog.html

 			<li>Added a doctype() function to the <a href="helpers/html_helper.html">HTML helper</a>.</li>
 			<li>Added ability to force lowercase for <kbd>url_title()</kbd> in the <a href="helpers/url_helper.html">URL helper</a>.</li>
 			<li>Changed the default "type" of <kbd>form_button()</kbd> to "button" from "submit" in the <a href="helpers/form_helper.html">form helper</a>.</li>
+			<li>Changed redirect() in the URL helper to allow redirections to URLs outside of the CI site.</li>
 		</ul>
 	</li>
 	<li>Other Changes