Hi, I'm searching all over the web but cannot find a solution to the following problems.
I want to redirect all requests to /aposerver/dome1 to a login page with php script which should do authentication. If authenticated a rewriterule should proceed. Please note that the php authentication cannot proceed with another page, because dome1 rewrite should be a total different system with a different application webserver.
I did the following:
<virtualhost *>
servername aposerver
rewriteengine on
rewritemap mysession prog:/srv/www/htdocs/login/checkcredentials.php
<Directory /srv/www/htdocs/dome1/*>
rewriteengine on
options +followsymlinks
rewritecond %{HTTP_COOKIE} !auth_name=([^;]+)
rewriterule .* - [L-,R=403]
rewritecond %{HTTP_COOKIE} auth_name=([^;]+)
rewritecond %{mysession:%1} !OK
rewriterule .* - [L,R=403]
</directory>
</virtualhost>
the php script as it's now only returns OK on every entry.
#!/usr/bin/php
<?php
set_time_limit(0); //no timeout
while($input = trim(fgets(STDIN, 1024))){
if ($input){
fputs(STDOUT, "OK");
}
fputs(STDOUT,"\n");
flush(); //send result to stdout, very important. no buffering
}
?>
So if I set the cookie auth_name to some value I should pass. But the result is that I can always see the page, also when the cookie is not available. What is wrong here.