[thelist] variable "www" with htaccess?

kasimir-k kasimir.k.lists at gmail.com
Mon Mar 10 14:29:27 CDT 2008

Joost van Velzen scribeva in 2008-03-10 13:34:
> Does anyone know how i can have the www part of an URL changed into 
> something I have in my database (e.g. a username)?
> Can i do this with htacces, do I need to change some apache settings as 
> well?

My first thought was "can't be done" - so I had to do some googling to 
see how it is done :-) I'm not an Apache guru, but hopefully can give 
you some pointers.

You'd have to use mod_rewrite[0] to rewrite "www" to your liking. You 
can use it in .htaccess files, but it works faster in httpd.conf.

That's the easy part... Getting mod_rewrite to talk to a db is the 
tricky thing. It could be using RewriteMap[1]. There's also 
mod_dbd[2][3], but I don't really know anything about it :-} However, in 
his blog Nick Kew says: "I’ve just added SQL database-based lookups to 
mod_rewrite’s rewritemap feature, using Apache DBD."[4]

Hopefully these links give some help. And once you get this thing 
working, please remember to tell us how :-)



More information about the thelist mailing list