[Typo3] ISAPIrewrite and RealURL - Working on IIS 6!
Steven Bagshaw
steven.bagshaw at unv.org
Fri Oct 21 11:43:37 CEST 2005
Hi,
I got it working. This is using IIS 6, Typo3 3.8 and ISAPI Rewrite.
First of all, I used a RewriteRule to put the entire path, minus the domain
name, into a query string param to index.php
RewriteRule (.*).html /index.php?iisrewr=$1\.html [L]
Then I modified class.t3lib_div.php.getIndpEnv() as follows...
case 'REQUEST_URI':
// Typical application of REQUEST_URI is return urls, forms submitting
to itself etc. Example:
returnUrl='.rawurlencode(t3lib_div::getIndpEnv('REQUEST_URI'))
//HACK HERE FOR ISAPI_REWRITE ON IIS - for this to work, you need a rule
in httpd.ini for ISAPI Rewrite like
// RewriteRule (.*).html /index.php?iisrewr=$1\.html [L]
//We therefore put a whole URL into query string param that can then be
picked up here.
//Without this, the $_SERVER object does not seem to have any reference
at all to the actual URL being called.
//The ISAPI Rewrite DLL adds HTTP_X_REWRITE_URL to the HTTP header.
if (strpos($_SERVER['HTTP_X_REWRITE_URL'], 'iisrewr')) {
$startPos = strpos($_SERVER['HTTP_X_REWRITE_URL'], 'iisrewr') +
strlen('iisrewr') + 1; //+1 for is for leading /
return substr($_SERVER['HTTP_X_REWRITE_URL'], $startPos);
}
else if (!$_SERVER['REQUEST_URI']) { // This is for ISS/CGI which does
not have the REQUEST_URI available.
//if (!$_SERVER['REQUEST_URI']) { // This is for ISS/CGI which does not
have the REQUEST_URI available.
return
'/'.ereg_replace('^/','',t3lib_div::getIndpEnv('SCRIPT_NAME')).
($_SERVER['QUERY_STRING']?'?'.$_SERVER['QUERY_STRING']:'');
} else return $_SERVER['REQUEST_URI'];
break;I hope this helps someone.Steven"Steven Bagshaw"
<steven.bagshaw at unv.org> wrote in message
news:mailman.1.1129813108.19022.typo3-english at lists.netfielders.de...
> Hello,
>
> We are having a lot of problems getting RealURL to work using IIS. It is
> working fine in Apache on our dev server, but the IT shop here insists on
> using IIS for the live server.
>
> We have ISAPIrewrite installed and working for a test case. But I cannot
get
> the rules working to feed RealURL correctly. Does anyone out there have a
> working rule for IIS and RealURL?
>
> Our URLs look something like
>
http://mydomain.org/en/news-views/volunteer-stories/part-of-the/lang/en.html
> - so they're fairly long and have some custom parameters in the URL.
>
> Thanks!
>
> Steven
>
>
More information about the TYPO3-english
mailing list