Redireccionar Páginas

Started by ne.miguelito, November 21, 2007, 12:51:09 PM

Previous topic - Next topic

ne.miguelito

Boas amigos,

alguém sabe um código em php que eu por exemplo coloque num ficheiro index.php dentro de uma directoria e Redireccione para por exemplo para a página inicial (home), ou também penso que em html funcione neste caso metia num ficheiro index.html, se alguém me pode-se ajudar agradecia.


Cumps.

®µÏ™

a tua questão está um pouco confusa mas ve isto:

Simples

Quote<?
header("location: http://somedomain.com/somepage.php");
?>


Mais trabalhado


PHP Redirect Function

This is our PHP redirect() function, it has been tested with PHP versions >= 4.2.0. Seen a lot of requests for this on various mailing lists so we thought we'd share.

We've added support for different HTTP/1.1 3XX status codes. Each of the response codes tell the requesting User-Agent how to respond as described below.

In the W3C specification it's stated that the server should also give some content back for the User-Agent to render if it does not obey the redirect. This redirect function will output some pretty HTML if the headers have already been sent following the W3C intentions.

    * 301 Moved Permanently - Forget the old page existed
    * 302 Found - Use the same method (GET/POST) to request the specified page.
    * 303 See Other - Use GET to request the specified page. Use this to redirct after a POST.
    * 307 Temporary Redirect - Good for response to POST.


Quote<?php
// Do stuff here before sending headers
redirect('/')
redirect("/my/page")
redirect("http://www.foo.bar/page.htm",303)
redirect("./index.php",307)
?>

PORTALTEK

www.portaltek.net               »» Loja On-Line
www.portaltek.net/forum     »» Suporte e Outros

ne.miguelito

#2
Boas,

já consegui com este simples código em html.

<meta http-equiv="refresh" content="0; url=http://www.home.com">


simplesmente meti isto num ficheiro com o nome index.html e faz o que eu quero, mas obrigado na mesma

Advertisement: