Foros del Web » Programando para Internet » PHP »

Duda con clase seo, url amigables y htaccess

Estas en el tema de Duda con clase seo, url amigables y htaccess en el foro de PHP en Foros del Web. Hola tengo esta duda con una clase seo y me gustarian que me ayudaran. class.SEO.php Código PHP:    <?php      class  SEO  {          /* ...
  #1 (permalink)  
Antiguo 04/11/2009, 21:00
Avatar de Watas  
Fecha de Ingreso: diciembre-2005
Ubicación: Caracas
Mensajes: 151
Antigüedad: 18 años, 4 meses
Puntos: 0
Pregunta Ayda con clase seo y url amigables

Hola tengo esta duda con una clase seo y me gustarian que me ayudaran.

class.SEO.php
Código PHP:

  <?php

    
class SEO {
        
/*
        Method to replace characters not accepted in URLs
        */
        
function scapeURL ($text) {
            
// Tranformamos todo a minusculas 
            
$text strtolower($text); 
            
//Rememplazamos caracteres especiales latinos 
            
$find = array('á''é''í''ó''ú''ñ'); 
            
$repl = array('a''e''i''o''u''n'); 
            
$text str_replace ($find$repl$text); 
            
// Añaadimos los guiones 
            
$find = array('-''&''\r\n''\n''+'); 
            
$text str_replace ($find' '$text); 
            
// Eliminamos y Reemplazamos demás caracteres especiales 
            
$find = array('/[^a-z0-9\-<>]/''/[\-]+/''/<[^>]*>/'); 
            
$repl = array('-''-''-'); 
            
$text preg_replace ($find$repl$text); 
            return 
$text
        }
        
/*
        Make rich links
        */
        
function categoria ($categoria_id) {
          
$scape_categoria_id $this->scapeURL($categoria_id);
          
$url 'http://127.0.0.1/alpezmed/web/productos/'.$scape_categoria_id.'.html';
          return 
$url;
        }
        function 
subcategoria ($subcategoria_id) {
          
$scape_subcategoria_id $this->scapeURL($subcategoria_id);
          
$url 'http://127.0.0.1/alpezmed/web/productos/'.$scape_subcategoria_id.'.html';
          return 
$url;
        }
        function 
nombre ($nombre) {
          
$scape_nombre $this->scapeURL($nombre);
          
$url 'http://127.0.0.1/alpezmed/web/productos/'.$scape_nombre.'.html';
          return 
$url;
        }
        
            }

class 
Redirect extends SEO {
        
/*
        Get keyword-rich URL
        */
        
function getCategoryProductUrl() {
          
//Get id and category product
          
$categoria_id $_GET['categoria_id'];
          
$subcategoria_id $_GET['subcategoria_id'];
          
$nombre $_GET['nombre'];

          
/*
          If you have a database
          */
          
$categoria_id "";
          
$subcategoria_id "";
          
$nombre "";
          
//Keyword-rich URL
          
$url $this->categoria($categoria_id);
          return 
$url;
        }
        
/*
        Redirects URL
        */
        
function categoryProductUrl() {
          
//Get URL
          
$redirected_url $this->getCategoryProductUrl();
          
//301 Redirection
          
if ("http://127.0.0.1/" $_SERVER['REQUEST_URI'] != $redirected_url) {
            
header('HTTP/1.1 301 Moved Permanently');
            
header('Location: ' $redirected_url);
            exit();
          }
        }
        
/*
        Remove index.php using 301 redirection
        */
        
function removeIndexUrl() {
          
//if the request contains index.php redirect
          
if (preg_match('#(.*)index\.(html|php)$#'$_SERVER['REQUEST_URI'], $captures)) {
            
// 301 redirection
            
header('HTTP/1.1 301 Moved Permanently');
            
header('Location: ' $captures[1]);
          }
        }
    }

?>


Al realizar el RollOver en el link de la categoria, subcategoria y del producto si muestra el nombre correcto, es decir, que si recoge el id en cada de uno de esos links.

Pero al hacer click en el mismo, me arroja como resultado una pagina en blanco, sin resultados.


En el htaccess tengo este codigo:

Código:
RewriteRule ^(.*)\.html$          subcategoria.php?categoria_id=$1 [L]
RewriteRule ^(.*)\.html$	 producto.php?subcategoria_id=$1 [L]
RewriteRule ^(.*)\.html$	 detalle.php?nombre=$1 [L]
Que estoy haciendo mal????
Por favor ayudenme ya no se que hacer!!!

Gracias y saludos!!!!

Última edición por Watas; 09/11/2009 a las 17:35 Razón: Remplateo de la pregunta
  #2 (permalink)  
Antiguo 09/11/2009, 17:56
Avatar de Watas  
Fecha de Ingreso: diciembre-2005
Ubicación: Caracas
Mensajes: 151
Antigüedad: 18 años, 4 meses
Puntos: 0
Respuesta: Duda con clase seo, url amigables y htaccess

Nadie me puede ayudar con esto????
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 01:16.