On this given server running Apache, mod_rewrite is executed prior to mod_auth. Normally not a critical issue except when you are trying to use the environmental variable, %{REMOTE_USER} - per .htaccess. In this scenario, it is undefined and unavailable to mod_rewrite. I have only seen this once before, and cannot recall the solution. It is related to server config (httpd.conf). Any ideas?
Asked
Active
Viewed 608 times
1 Answers
1
You need to move your rules to your vhost/server config, and not inside of a <Directory>
container. This makes it so the per-directory modules are applied first (e.g. mod_auth_*) before the per-server module (i.e. mod_rewrite).

Jon Lin
- 142,182
- 29
- 220
- 220
-
No
involved, and the rules are located in .htaccess. – Daniel Abrams Jul 31 '13 at 00:34 -
@DanielAbrams .htaccess is essentially a `
` container. Those rules need to be moved into the server/vhost's context. – Jon Lin Jul 31 '13 at 03:47 -
Gotta disagree. It is common to combine both per .htaccess (and noted in Apache docs), and I've done it on nearly 2000 servers. The problem is that one this one server mod_rewrite is executed first which is contrary to Apache default order. Had this same issue on another server a year or two back back, and it required an edit to server config, but cannot recall the edit. – Daniel Abrams Jul 31 '13 at 04:44
-
@DanielAbrams If it's your server and you want this change to affect all vhosts then check the module load order in httpd.conf. If they've been statically compiled, then not sure what you can do. – Jon Lin Jul 31 '13 at 05:10
-
No, not my server. I'm referring to 1000's of servers corresponding to 1000's of clients, independent of each other. One client has this issue, which is unrelated to others. Yes, module load order could be it. Will look into it, and report back. Thanks! – Daniel Abrams Jul 31 '13 at 05:44