Por: Gonzalo Escribano
A Programmed RewriteMap for mod_rewrite in PHP
July 16, 2010
written in PHP to provide a programmed response for
mod_rewrite. If you want to rewrite URLs that are
stored in a MySQL database, simply add in a
mysql_connect before you enter the loop, and then
do the appropriate query within the loop! */
/* Extra lines to add to httpd.conf:
RewriteEngine On
RewriteMap tryme prg:/home/trainee/website/andy
RewriteRule (.*.htm) ${tryme:$1}
*/
set_time_limit(0); # forever program!
$keyboard = fopen(“php://stdin”,”r”);
while (1) {
$line = trim(fgets($keyboard));
if (preg_match(‘/^(.*).htm$/’,$line,$igot)) {
print “$igot[1].htmln”;
} else {
print “$linen”;
}
}
?>
Fuente:
http://www.wellho.net/resources/ex.php4?item=a603/andy