[TYPO3-dev] realurl and redirects

Martin Kutschker martin.kutschker-n0spam at no5pam-blackbox.net
Wed May 14 14:38:58 CEST 2008


Steffen Kamper schrieb:
> Hi,
> 
> i encountered a problem with redirect and realurl. It was on 4.0.1, but may 
> be it exists on later versions too.
> The problem was that
> $redirectUrl = $this->pi_getPageLink($this->piVars['backPid']);
> header('location:'.$redirectUrl);
> 
> leads to wrong urls as some pagesegments were repeated.
> Using this fixed it:
> 
> $redirectUrl = $this->pi_getPageLink($this->piVars['backPid']);
> header('location:'.t3lib_div::locationHeaderUrl($redirectUrl));
> 
> I stumbled why that happens as i thought i will be save any time using 
> typolink-functions.
> 
> Can this be confirmed?

I can confirm that you were using the header() function call wrong. :-)

Always send a full URI including the protocol in a location header. This 
is was t3lib_div::locationHeaderUrl() ensures as 
pi_base::pi_getPageLink() only returns an internal link.

Masi




More information about the TYPO3-dev mailing list