A ver le muestro lo que hice hasta ahora:
Cree un Archivo .htaccess con el siguiente codigo:
Código:
RewriteEngine on
RewriteRule ^([a-zA-Z0-9_]*).* index.php?variable=$1
luego cree un index.php con el siguiente codigo:
Código PHP:
<?php
if (isset($_GET['variable'])){
echo $_GET['variable'];
}
ob_start();
function replace_for_mod_rewrite(&$s) {
$urlin = array(
"'(?<!/)index.php\?variable=([a-zA-Z0-9_]*)'"
);
$urlout = array(
"\\1.html"
);
$s = preg_replace($urlin, $urlout, $s);
return $s;
}
echo" <p>Enlace <a href=\"index.php?variable=cosa\">index.php?variable=cosa</a></p> ";
$contents = ob_get_contents(); // store buffer in $contents
ob_end_clean(); // delete output buffer and stop buffering
echo replace_for_mod_rewrite($contents); //display modified buffer to screen
?>
y no me anda me devuelve Siempre:
index
Enlace cosa.html
en cambio sin mod_rewrite el index.php anda bien, pero lo necesito con mod_rewrite mmm que estoy haciendo mal ?