Hi to All,
I have a problem that I can't solve, though the code looks correct to me.
I'm using two RewriteConditions using two COOKIES to control a Rewrite Rule that, if the cookies are not on the computer, will redirect to the Indexx2.php page. That works fine.
I have a further Rewrite rule controlled by four additional RewriteConditions:
If three of the four cookies exist, then the visitor is redirected to the Login page. This is the broken part; it is redirecting to the URL but it is leaving part of the URL out.
I have declared two of the COOKIES as variables with (), and I've inserted them into the redirect absolute URL.
One of them, the Login_%1, works just fine but the %3 simply does nothing; it won't deploy the value.
I've rewritten this so many times that I hardly know what is what anymore but this current configuration seems to get me 2/3 of the way there.
I'm on Apache 1.3xx and I cannot for the life of me, (one week running now) figure out why I can't pick up the other variable; it just leaves an empty // in the URL where the word should show up.
All help is greatly appreciated.
Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_COOKIE} !prime_lang.*$ [NC]
RewriteCond %{HTTP_COOKIE} !targ_lang.*$ [NC]
RewriteRule .* http://www\.mysite\.com/Indexx2\.php [NC,R]
RewriteCond %{HTTP_COOKIE} !targ_nationality=[a-zA-Z] [NC]
RewriteCond %{HTTP_COOKIE} prime_lang=([a-zA-Z]+) [NC]
RewriteCond %{HTTP_COOKIE} targ_lang=[a-zA-Z]+ [NC]
RewriteCond %{HTTP_COOKIE} level1=([a-zA-Z]+) [NC]
RewriteRule .* http://www\.mysite\.com/Login/%2/Login_%1\.php [NC,R]
The Login_%1 outputs the level1 COOKIE , i.e. either Student or Teacher. and it works fine.
The %2 should output the name of the language, i.e. /English/ and it dun woik at all.
The final URL should read as:
www.mysite.com/Login/English/Login_Student.php or
www.mysite.com/Login/German/Login_Teacher.php or whatever the variable happens to be. But all I'm getting is
www.mysite.com/Login//Login_Student.php
Lastly, thank you for reading this and responding.