[TYPO3-dev] getIndpEnv('TYPO3_SITE_URL') problems when using mod_rewrite in httpd.conf (Apache)

Ulrich Fischer ulrich-fischer at gmx.net
Thu Jul 26 11:18:59 CEST 2007


Hi,

mostly 2005 this was discussed very hardly but without any
solution yet.

Martin Kutschker schrieb am 22.08.2006 18:21:
> getIndpEnv() tries to determine the TYPO3_SITE_URL via TYPO3_REQUEST_DIR 
> and the constants PATH_thisScript and PATH_site. But TYPO3_REQUEST_DIR 
> is based on SCRIPT_NAME.
> .htaccess:
> SCRIPT_NAME /base/index.php
> 
> httpd.conf:
> SCRIPT_NAME /base/abc/def
> 
> The script now tries to compare apples and bananas. The result is a 
> broken TYPO3_REQUEST_DIR. Instead of http://host/base/ it is 
> http://host/base/abc/. So TYPO3_SITE_URL is also wrong.


Martin you are right and I have spend some
hours, to identify the same fact.

In my case (httpd.conf)
SCRIPT_NAME = /my-subdirectory/test-page.html
on al my other servers it is (.htaccess)
SCRIPT_NAME = /index.php

I think this is _not wrong_ to get the real requested url,
when the constant is called "REQUEST" directory.


My suggestion is, to get rid of SCRIPT_NAME in this
case, because it is not necessary.
I think it is quite better, to fetch TYPO3_REQUEST_HOST for the host
and then append "lPath", which has identified the subdirectory
of typo3 installation.

Or did I think wrong? Is it possible, that there is a difference
between physical and virtual subdirectory?

1: case 'TYPO3_SITE_URL':
2:  if (defined('PATH_thisScript') && defined('PATH_site'))	{
# 3:    $lPath = substr(dirname(PATH_thisScript),strlen(PATH_site)).'/';
# 4:    $url = t3lib_div::getIndpEnv('TYPO3_REQUEST_DIR');
4:    $host = t3lib_div::getIndpEnv('TYPO3_REQUEST_HOST');
5:    $siteUrl = $host.$lPath;
5:    $siteUrl = substr($url,0,-strlen($lPath));
6:    if (substr($siteUrl,-1)!='/')	$siteUrl.='/';
7:    $retVal = $siteUrl;
8:  }
9: break;

I have written a bugreport
http://bugs.typo3.org/view.php?id=1274#15046

It would be nice, if the problem could be solved in
the next update :-)

Greetings

Ulrich


-- 
http://www.sunfish.de




More information about the TYPO3-dev mailing list