mod_rewrite with mysql support

This patch adds mysql support to apache 2.0.54's mod_rewrite. It is an exact port of a patch by Régis Grison for apache 1.3. Like the original, it also adds an additional variable, SUBDOMAIN_NAME, which contains the subdomain part (everything left of the second dot from the right).

usage

Create a file mysqlmap (or whatever) containing:

server mysql.example.org
port   3306
user   login
passwd password
base   databasename
select SELECT column FROM table where key='$1'

Add to your apache config file:

RewriteEngine On
RewriteMap rewritemap mysql:/path/to/mysqlmap
RewriteRule ^/foo$ ${rewritemap:bar}

Any occurence of $1 in the select clause will be substituted with bar. Only the first column from the first result row will be used.



last update: 2006-12-22 11:08 by: js
© 2002-2007 by Jakob Schröter