[TYPO3] Coolori - redirect fails with http://www.example.org/www.example.com@

Steffen Gebert steffen at steffen-gebert.de
Thu Jul 31 00:05:32 CEST 2008


Hi Jan,

Sorry for starting yet another bug report on the list (should I write it to
forge instead?). It's just because I can't localize the real problem.

I've got a problem with redirecting to a new created domain. All the old
links from a whole branch don't work.

Situation as follows:
URL is www.example.org/sompath/; since some days they've got their own
domain www.example.com
so www.example.org/sompath/* should be redirected to www.example.com/*

Link_Translate::cool2params finds nothing in link_cache, so searches in
link_oldlinks

SELECT link_cache.url AS oldlink FROM link_oldlinks  LEFT JOIN link_cache ON
link_oldlinks.link_id=link_cache.id WHERE
link_oldlinks.url='www.example.org at somepath/'
this returns oldlink = www.example.com@ (so far, so good)

This result is processed in
Link_Func::redirect(Link_Func::prepareforRedirect($row['oldlink'].(empty($te
mpuri[1])?'':'?'.$tempuri[1]),$lConf));

Link_Func::prepareforRedirect($path = 'www.example.com@', $lConf)
returns 'www.example.com@'
is this still GOOD?

LinkFunc::redirect($path = 'www.example.com@')
if (!preg_match('~^http://~',$path))
matches of course NOT, so 
'http://'.$_SERVER['HTTP_HOST'].'/' is prepended to $path

header('Location: '.$path);
with $path = http://www.example.org/www.example.com@

So far, so BAD.

I wonder how ever it worked in the past. I think
Link_Func::prepareforRedirect does sth. wrong. There I don't understand
if (....&&
substr($path,0,strlen($lConf->cache->prefix))==$lConf->cache->prefix) {
  $path = 'http://...';
}
I think we should add http:// also for $path not starting with
$lConf->cache->prefix but anything else containing an @ (which might lead to
other problems...)
What should $lConf->cache->prefix be? Is www.example.org@ right, while
calling www.example.org/somepath/ or should it be www.example.com@ instead?
Then the if-clause should be okay (but anything else wrong...)

Also link_cache and link_oldlinks looks good. Hope you can see, where
http:// should be added before calling redirect (and I think this should be
done in prepareforRedirect)

Thanks for your support!

Steffen



More information about the TYPO3-english mailing list