fbpx

A Programmed RewriteMap for mod_rewrite in PHP

July 16, 2010

Source Code

#!/usr/local/bin/php
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

avatar
Gonzalo Escribano

Ver entradas

Most Recent

June 9, 2022

¿Qué son las DAO y cuáles son sus beneficios?

Es común en la historia contemporánea que haya cambios a partir de los avances en el campo de la...

Read More

June 2, 2022

¿Qué son las DeFi y por qué son el futuro de las finanzas?

Es común en la historia contemporánea que haya cambios a partir de los avances en el campo de la...

Read More

May 27, 2022

How to start a successful product build from scratch?

Creating a product from scratch could be a huge challenge. To achieve your business goals it’s important to develop...

Read More