Bug #17878

mod_rewrite redirect to subdirectory + realurl = page not found

Added by Victor Sergienko about 12 years ago. Updated over 6 years ago.

Should have
Target version:
Start date:
Due date:
% Done:


TYPO3 Version:
PHP Version:
Is Regression:
Sprint Focus:


I have a site installed into /typo3 subdirecttory of hosting user home dir.
In that directory, .htaccess uses mod_rewrite to redirect certain domain to /typo3 directory:
RewriteCond %{HTTP_HOST} ^(www\.)?herethere\.info [NC]
RewriteRule ^/?(.*)$ typo3/$1 [L]

In the subdirectory:
I have only changed the last mod_rewrite rule in typo3/.htaccess:
  1. For use with the RealUrl extension, you might need to remove the
  2. RewriteBase directive somewhere above and use this line instead of the
  3. next one:
    RewriteRule ^(.*)$ /typo3/index.php [L]

The problem in Typo3 is that TYPO3_SITE_URL in t3lib\class.t3lib_div.php is calculated as:
case 'TYPO3_SITE_URL':
if (defined('PATH_thisScript') && defined('PATH_site')) {
$lPath = substr(dirname(PATH_thisScript),strlen(PATH_site)).'/';
$url = t3lib_div::getIndpEnv('TYPO3_REQUEST_DIR');
$siteUrl = substr($url,0,-strlen($lPath));
if (substr($siteUrl,-1)!='/') $siteUrl.='/';
$retVal = $siteUrl;

This returns "ts/Framework.html" instead of "Products/Framework.html". So I get "page not found".

While RealUrl expects TYPO3_SITE_URL to be config.baseURL.

This applies to 4.1.3 also.

I hacked it to use TYPO3_REQUEST_HOST ( http://herethere.info ) instead of TYPO3_REQUEST_DIR, but config.baseURL seems more correct way, if it is set.
(issue imported from #M6878)

Related issues

Related to TYPO3 Core - Bug #14856: TYPO3_SITE_URL is not set correct Closed 2005-07-11
Related to TYPO3 Core - Bug #14410: RealURL does not work, because TYPO3_SITE_URL value is wrong Closed 2004-11-24
Related to TYPO3 Core - Bug #16335: t3lib_div::getIndpEnv('TYPO3_DOCUMENT_ROOT') delivers wrong value in Backend Closed 2006-07-11
Related to TYPO3 Core - Bug #18816: TYPO3_SITE_URL in t3lib_div::locationHeaderUrl to support TYPO3 installed in subfolders Closed 2008-05-19


#1 Updated by Alexander Opitz almost 7 years ago

  • Status changed from New to Needs Feedback
  • Target version deleted (0)

The issue is very old, does this issue exists in newer versions of TYPO3 CMS (4.5 or 6.1)?

#2 Updated by Alexander Opitz over 6 years ago

  • Status changed from Needs Feedback to Closed
  • Is Regression set to No

No feedback for over 90 days.

Also available in: Atom PDF