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 ?
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.