Forum Moderators: phranque

Message Too Old, No Replies

REMOTE_USER not working on apache 2.0

REMOTE_USER not working on apache 2.0

         

merrioc

11:55 am on Apr 30, 2004 (gmt 0)

10+ Year Member



RewriteCond %{REMOTE_USER} ^goforit
RewriteRule .* [script.com...] [F]

This is the .htaccess rewrite rule I used for the longest time, We moved to a new server company and now the rule doesn't want to work. mod_env is there so is mod_rewrite and mod_ldap, the Envirnmental variable of REMOTE_USER comes from mod_rewrite. I was told, and found some documentation that fastCGI has issues with REMOTE_USER. I removed that and still nothing. I also tried with and withoutthe L-A (look ahead) to see if apache was moving the username after the url. Nothing.

If I place <!--#echo var="REMOTE_USER" --> in a shtml document I get a user agent. I just confused why the rewrite rule is no longer working and if anyone knows a solution

jdMorgan

2:38 pm on Apr 30, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



> If I place <!--#echo var="REMOTE_USER" --> in a shtml document I get a user agent.

Just to be sure, do you mean you get a username or a user-agent?


RewriteCond %{REMOTE_USER} ^goforit
RewriteRule .* [script.com...] [F]

I've tried that kind of RewriteRule before, and had problems on Apache 1.x. -- Not with the REMOTE_USER variable, but with the Rule itself. I ended up using

ErrorDocument 403 /out.php
RewriteCond %{REMOTE_USER} ^goforit
RewriteRule .* - [F]

The relevant questions are A) Will Apache accept a URL with [F]?, and B) If you provide a canonical URL instead of a local URL-path, will Apache return a 403 or a 302 instead? In other words would your code work better on Apache 2 if you said
RewriteRule .* /out.php [F]

instead?

You might want to check all this with the Server Headers checker.

Jim

merrioc

6:37 pm on Apr 30, 2004 (gmt 0)

10+ Year Member



okay Imean user not user agent, typo...

Server Headers checker?

what is this?

merrioc

7:07 pm on Apr 30, 2004 (gmt 0)

10+ Year Member



okay tried your method, no effect. its not redirecting anything nor is it spitting anything to the error log. I havne't been abel to get rewrite logging to work to see if its soemthing there.

jdMorgan

7:08 pm on Apr 30, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I wasn't picking on you for a typo, but if REMOTE_USER was returning the value from HTTP_USER_AGENT, that would be an entirely different problem.

Click path: WebmasterWorld->control panel->Server Headers [webmasterworld.com] checker. Very handy.

Jim