[TYPO3-english] Redirect to subdirectory - siteScript is shortend

Simon Child simon at srchild.com
Fri Oct 5 00:30:07 CEST 2012


"Jan Bednarik" <info at bednarik.org> wrote in message 
news:mailman.1.1349298840.6118.typo3-english at lists.typo3.org...
> Hi,
>
> I have a TYPO3 (4.5) running in a subdirectory "old", I'm now redirecting 
> a domain example.com to this subdirectory:
>
> RewriteCond %{HTTP_HOST} ^(www\.)?example\.com$
> RewriteRule ^(.*)$  /old/$1 [L]
>
> The problem is, that I want to use CoolUri for this new domain, but it 
> doesn't work since $params['pObj']->siteScript is shortend by 3 
> characters.

[snip]

> I think the problem is in t3lib_div:
>
> case 'TYPO3_SITE_URL':
> if (defined('PATH_thisScript') && defined('PATH_site')) {
> $lPath = substr(dirname(PATH_thisScript), strlen(PATH_site)) . '/';
> $url = self::getIndpEnv('TYPO3_REQUEST_DIR');
> $siteUrl = substr($url, 0, -strlen($lPath));
> if (substr($siteUrl, -1) != '/') {
> $siteUrl .= '/';
> }
> $retVal = $siteUrl;
> }
> break;

It seems that the three characters in 'old' are confusing the length of the 
substr required - the redirect is 'hiding' those three characters, but they 
are needed when counting the length of the substr to take from the filepath

so experiment with something like

$lPath = substr(dirname(PATH_thisScript), strlen(PATH_site)-3) . '/';

(but that might not be correct, just a guess, maybe +3 instead!)

-- 
Simon Child










More information about the TYPO3-english mailing list