[TYPO3] IP-based redirect: problem with RewriteRule in .htaccess

Bert Hiddink hiddink at bendoo.com
Mon Nov 20 16:36:27 CET 2006


Hello,

I would like to achieve an IP-based redirect through the .htaccess which 
I had already in place for RealURL:

RewriteEngine On
#RealURL
RewriteRule ^typo3$ - [L]
RewriteRule ^typo3/.*$ - [L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule (\.html|/)$ /index.php

#case 1: Redirect on IP-basis
RewriteCond %{REMOTE_ADDR} 123.123.123.123
# This works fine
RewriteRule ^$ /index.php?123

#case 2: Redirect on IP-basis: works ok
RewriteCond %{REMOTE_ADDR} 456.456.456.456

# This does not work: seems to create
# an endless loop
RewriteRule ^$ http://www.mysite.com

I get the following error in my browser (FF):

"The page isn't redirecting properly
Firefox has detected that the server is redirecting the request for this 
address in a way that will never complete.
     *   This problem can sometimes be caused by disabling or refusing 
to accept  cookies."

Case 1 is working fine, case 2 is not working when http://www.mysite.com 
is an alias for the main-domain. That is, if would change it for an 
external domain (fe. http://www.typo3.com), the rule works correctly.

Any ideas why this occurs? Any ideas how to resolve this? Many thanks in 
advance!!!

grt,
-brt

-- 
Bert Hiddink
hiddink at bendoo.nl
BENDOO e-work solutions
http://www.bendoo.nl
Harterinkdijk 8, 7065 AR SINDEREN
The Netherlands
Tel. 0315 244525



More information about the TYPO3-english mailing list