fix url https bug.

This commit is contained in:
Taylor Otwell 2012-04-04 11:08:14 -05:00
parent e78c90b993
commit c31f001f22
1 changed files with 5 additions and 1 deletions

View File

@ -63,7 +63,7 @@ public static function base()
// If the application's URL configuration is set, we will just use that // If the application's URL configuration is set, we will just use that
// instead of trying to guess the URL from the $_SERVER array's host // instead of trying to guess the URL from the $_SERVER array's host
// and script variables as this is more reliable. // and script variables as this is a more reliable method.
if (($url = Config::get('application.url')) !== '') if (($url = Config::get('application.url')) !== '')
{ {
$base = $url; $base = $url;
@ -112,6 +112,10 @@ public static function to($url = '', $https = false)
{ {
$root = preg_replace('~http://~', 'https://', $root, 1); $root = preg_replace('~http://~', 'https://', $root, 1);
} }
else
{
$root = preg_replace('~https://~', 'http://', $root, 1);
}
return rtrim($root, '/').'/'.ltrim($url, '/'); return rtrim($root, '/').'/'.ltrim($url, '/');
} }