Foro de elhacker.net

Programación => Desarrollo Web => Mensaje iniciado por: Cergath en 10 Enero 2012, 15:58 pm



Título: ¿Como modificar todas las URLs?
Publicado por: Cergath en 10 Enero 2012, 15:58 pm
Hola,

Me gustaría hacer algo parecido a taringa, que cuando das click en un archivo de Descarga te manda a una página que dice: Estás saliendo de taringa, y aparece una barra de taringa en la parte superior.

El Script en php ya lo tengo, pero quiero ahora hacer alguna especie de redirección por htaccess o que automáticamente transforme TODAS las URLs del sitio de:

http://google.com/ a: http://misitio.com/fuera.php?http://google.com/

¿Alguna idea?

Gracias!


Título: Re: ¿Como modificar todas las URLs?
Publicado por: #!drvy en 10 Enero 2012, 16:07 pm
javascript como mucho... los enlaces trabajan directamente sobre el navegador..

Vamos que si el navegador ve un enlace a otra pagina, abre otra pagina, no se pasea por la tuya.


PD: Podrias con PHP hacer que filtre los enlaces, pero seria para nuevos enlaces.


Saludos


Título: Re: ¿Como modificar todas las URLs?
Publicado por: Shell Root en 10 Enero 2012, 23:10 pm
Código
  1.     <head>
  2.          <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
  3.     </head>
  4.     <body>
  5.  
  6.          <a href="http://foro.elhacker.net/profiles/shellroot-u327468.html" title="foro.elhacker.net">Shell Root - elhacker.net</a>
  7.          <br>
  8.          <a href="http://shellrootsecurity.blogspot.com/" title="in[S]eguridad [I]nformatica">Shell Root - in[S]eguridad [I]nformatica</a>
  9.  
  10.     </body>
  11.  
  12.     <script languaje="javascript">
  13.  
  14.          $(document).ready(function(){
  15.               $('a').each(function( i ){
  16.                    var urlFilter = 'http://shellroot?link=';
  17.                    var urlModified = $(this).attr("href");
  18.                    $(this).attr( "href", urlFilter + urlModified );
  19.               });
  20.          });
  21.  
  22.     </script>
  23. </html>

Resultado:
Código
  1. http://shellroot/?link=http://foro.elhacker.net/profiles/shellroot-u327468.html
  2. http://shellroot/?link=http://shellrootsecurity.blogspot.com/