Tema: url amigable
Ver Mensaje Individual
  #4 (permalink)  
Antiguo 23/08/2010, 06:00
kyeownz
 
Fecha de Ingreso: diciembre-2009
Mensajes: 20
Antigüedad: 14 años, 4 meses
Puntos: 2
Respuesta: url amigable

Bueno, he conseguido que me redirija bien ya y va todo perfecto excepto:
no me coje las css, js, include, etc...:

Código PHP:
<?php
    session_name
("url_amigable");
    
session_start();
    
$Server=$_SERVER['SERVER_NAME'];
    
$Script=$_SERVER['PHP_SELF'];
    
$Variables=$_SERVER['QUERY_STRING'];

if(
$_SESSION['Listo']==0){
    
$vari explode("&",$Variables);
    for(
$i=0;$i<count($vari);$i++){
        
$vari2 explode("=",$vari[$i]);
        for(
$j=0;$j<count($vari2);$j++){
            if((int)
$vari2[$j]){
                
$amigable "/".$vari2[$j];
            }
        }
    }
    
    
$dir str_replace(".php","",$Script);
    
$url_amigable "http://".$Server.$dir.$amigable;
    
$_SESSION['Listo']=1;
    
header("Location: $url_amigable");
    exit;
}
    
$_URL_BASE="http://".$Server.$Script;
?>
Código PHP:
<base href="<?php echo $_URL_BASE;?>"  target="_top"/>
He estado leyendo y me da que es por el base href pero no doy con la solucion.

Con el .htaccess tambien tengo un problema y es que si no le paso ninguna variable por $_GET me salta a un 500 Internal Server Error:

Código:
Options +FollowSymLinks
RewriteEngine on

Rewriterule (.*) $1.php
Rewriterule (.*)/(.*) $1.php?id=$2
Muchas gracias de antemano.