[TYPO3] Getting complete URL

Joerg Schoppet joerg at schoppet.de
Thu Aug 24 09:27:50 CEST 2006


Peter Poulsen wrote:
> Some code:
> 
> $link = $GLOBALS['TSFE']->cObj->currentPageURL(array('foo' => 'bar'));
> header('Location: '. $link);
> 
> This won't work as $link is:
> this/page/?foo=bar (using realurl)
> 
> I would like to have something like:
> http://myserver.dk/this/page/?foo=bar
> 
> Is there a 'typo3-way' of prepending the server name to the link?
> 
> Also, is there a better way of making a redirect in typo3, than simply
> using php's header('location....)?
> 
> /peter
> 
Hi,

try this:

$link = t3lib_div::getIndpEnv('TYPO3_SITE_URL') . 
$GLOBALS['TSFE']->cObj->currentPageURL(array('foo' => 'bar'));

Joerg



More information about the TYPO3-english mailing list