Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

i have mod_rewrite rols that hard coded and i want to make it dynamic can i fatch somehow the users names from db ? or other variables i define in the config file ? ? this is what i have now :

RewriteRule ^/user01(.*) http://$1localhost:8086/RPC2 [P]
RewriteRule ^/user02(.*) http://$1localhost:8088/RPC2 [P]
RewriteRule ^/user03(.*) http://$1localhost:8089/RPC2 [P]
RewriteRule ^/user04(.*) http://$1localhost:8090/RPC2 [P]
RewriteRule ^/user05(.*) http://$1localhost:8091/RPC2 [P] 

as you can see each user i need to define it hard coded , can it be dynamic from db ?

share|improve this question

1 Answer 1

How about a RewriteMap? You'd need to write it a custom lookup handler if you want the lookups to happen against an actual database, but the text file format might fit your needs.

As a side-note: by putting user-provided input in the host-part of the proxy address, you're vulnerable to CVE-2011-3368. Make sure your Apache has been patched for that.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.