Apache 使用Laravel 4重定向到相对路径
在Laravel4.1中,是否可以重定向到相对路径而不是完整路径?如果我们看一下Apache 使用Laravel 4重定向到相对路径,apache,redirect,ssl,laravel,reverse-proxy,Apache,Redirect,Ssl,Laravel,Reverse Proxy,在Laravel4.1中,是否可以重定向到相对路径而不是完整路径?如果我们看一下UrlGenerator::to方法,我们得到的是: public function to($path, $extra = array(), $secure = null) { if ($this->isValidUrl($path)) { return $path; } $scheme = $this->getScheme
UrlGenerator::to
方法,我们得到的是:
public function to($path, $extra = array(), $secure = null)
{
if ($this->isValidUrl($path)) {
return $path;
}
$scheme = $this->getScheme($secure);
$tail = implode('/', array_map('rawurlencode', (array) $extra));
$root = $this->getRootUrl($scheme);
return $this->trimUrl($root, $path, $tail);
}
这将像这样(元代码):
mysite.com/url重定向::到('/test')=>mysite.com/test
我希望它被重定向到一个相对URL:
mysite.com/url重定向::到('/test')强>=>/测试
问题是,我所在的公司使用ReverseProxy将所有流量重定向到HTTPS协议,通过这种laravel重定向,我不断从HTTP重定向到HTTPS:
- 呼叫:GEThttp://mysite.com
- 代理:GEThttps://mysite.com
- 重定向到登录:GEThttp://mysite.com/login
- 代理:GEThttps://mysite.com/login
- 提交登录名:POSThttp://mysite.com/login
- 代理:POSThttps://mysite.com/login
是否有可能重定向到相对路径并让代理定义要使用的根url/协议?我在Laravel 4.2上,我在使用
重定向::远离('/test')
,不确定该函数是否在Laravel 4.1上