Comunidad de diseño web y desarrollo en internet online

Problema con variables GET, url amigables y htaccess

Citar            
MensajeEscrito el 09 Nov 2009 06:41 pm
Hola como estan, escribo para pedirles ayuda.
Tengo esta clase que reescribe las url amigables.

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/productos/'.$scape_categoria_id.'.html';
        return $url;
      }
      function subcategoria ($subcategoria_id) {
        $scape_subcategoria_id = $this->scapeURL($subcategoria_id);
        $url = 'http://127.0.0.1/productos/'.$scape_subcategoria_id.'.html';
        return $url;
      }
      function nombre ($nombre) {
        $scape_nombre = $this->scapeURL($nombre);
        $url = 'http://127.0.0.1/productos/'.$scape_nombre.'.html';
        return $url;
      }
      /*
         }

class Redirect extends SEO {
      /*
      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();
        }
      }
      /*
      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, $subcategoria_id, $nombre);
        return $url;
      }
      /*
      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]);
        }
      }
   }

?>





Que pasa, al hacer click sobre la url, si me cambia el link, es decir:

127.0.0.1/productos/subcategoria.php?categoria_id=Cannulated Screws

127.0.0.1/productos/cannulated-screws.html

pero no me arroja resultados, es decir, la pagina en blanco.

en mi archivo htaccess tengo esto

Código :


Options +FollowSymlinks
RewriteEngine On

RewriteRule ^categoria.html categoria.php

RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule . - [L]

RewriteRule ^(.*)\.html$                subcategoria.php?categoria_id=$1 [L]
RewriteRule ^(.*)\.html$    producto.php?subcategoria_id=$1 [L]
RewriteRule ^(.*)\.html$    detalle.php?nombre=$1 [L]

<files .htaccess>
order allow,deny
deny from all
</files>



Tengo una semana buscandole la solucion pero no la encuentro y no veo el porque no me muestra los resultados.

Espero que me ayuden porque ya me estoy halando los pelos de la nariz :shock: :lol:

Gracias de antemano!!! :D

Por watas

1 de clabLevel



 

msie8
Citar            
MensajeEscrito el 10 Nov 2009 12:08 pm
Nadie me puede ayudar en esto????

Por watas

1 de clabLevel



 

msie8
Citar            
MensajeEscrito el 13 Nov 2009 04:32 pm
tal vez [url]127.0.0.1/productos/cannulated-screws.html[/url] ESTÁ en blanco...

Por joarobles

753 de clabLevel

8 tutoriales

 

Córdoba - Argentina

firefox
Citar            
MensajeEscrito el 18 Nov 2009 04:52 pm
recomendacion cuando pases un valor de una variable no uses espacios usa un underline para decir que es el valor de una variable y recuerda la casensitividad Screw no es lo mismo q screw saludos

Por talcual

686 de clabLevel



 

Colombia

firefox

 

Cristalab BabyBlue v4 + V4 © 2011 Cristalab
Powered by ClabEngines v4, HTML5, love and ponies.