Modificar para que haga enlaces sin parametros - Modrewrite

alpujarra
04 de Abril del 2006
Tengo un script (Noah\'s Classifieds ) que me crea unos enlaces con muchas variables de este tipo:
Código:
http://www.misitio.com/index.php?method=range&list=advertisement_search&fromlist=advertisement_search&frommethod=showhtmllist&offset=20


He intentado investigar en el script para hacer mas amigables estas direcciones y he descubierto la funcion que crea dichos enlaces.

La funcion que me crea los enlaces es esta:

Cita:
function makeUrl($type="withScript")
{
//TODO: kiszedve: veryScriptName, x, u
// lehet, hogy meg tovabbi dolgok is vannak itt.
global $cgiUrl,$scriptName;


$s = "";
if( $type=="withScript" )
{
global $dotDot;
if (isset($dotDot)) $s.=$dotDot."/";
$s.="$scriptName?";
}
elseif( $type=="mixed" )
{
if( $cgiUrl )
{
$s.="http:/"."/$cgiUrl$scriptName?";
}
else
{
global $HTTP_SERVER_VARS;
$s.="http:/"."/$HTTP_SERVER_VARS[SERVER_NAME]".
substr($HTTP_SERVER_VARS["SCRIPT_NAME"], 0,
strrpos($HTTP_SERVER_VARS["SCRIPT_NAME"], "/")+1).
"$scriptName?";
}

}
$typ = $this->getTypeInfo();
$object_vars = get_object_vars($this);
foreach( $object_vars as $attr=>$value )
{
if( $value && (!isset($typ["attributes"][$attr]) || !in_array("no roll", $typ["attributes"][$attr])))
{
$value=urlencode($value);
$s.="$attr=$value&";
}
}
// Ha egy linkre kattintas utjan megy at az ember egy
// listre, akkor a megjelenites elott az offseteket nullazni
// kell:
if(isset($this->method) && $this->method=="showhtmllist" ) {
$s.="clearoff=1&";
}
if ($s=="index.php?") $s="index.php";//home url-ben ? ne legyen
$s=preg_replace("/&$/","",$s);//levagni az &-et a vegerol
return $s;
}


Para recortar la direcciones puse esto en vez de lo que esta en negrita:

Código:
if ($s=="index.php?") $s="index.php";//home url-ben ? ne legyen
$url = strtolower($s);
$find = array(\' \', \'&\', \'\r\n\', \'\n\', \'+\');
$url = str_replace ($find, \'-\', $url);
$find = array(\'/[^a-z0-9\-<>]/\', \'/[\-]+/\', \'/<[^>]*>/\');
$repl = array(\'\', \'\', \'\');
$url = preg_replace ($find, $repl, $url);
return $url;


La direccion quedaba asi:

Código:
http://www.misitio.com/indexphpmethodrangelistadvertisementsearchfromlistadvertisementsearchfrommethodshowhtmllistoffset20


Lo que hice fue eliminar los caracteres raros &, _, =, ?... pero esto sigue sin ser muy amigable (eso creo)

Aver si hay alquien capaz de decirme que modificar para hacer las direcciones mas cortas...

Despues me haria falta la sentencias de modrewrite para que que siga las nuevas url creadas ya que si no el script ya no funcionaria, mi server admite modrewrite.

Gracias adelantadas