p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


  Return to Index  

beginning_php thread: PHP Redirect


Message #1 by "MrQuietGuy" <mrquietguy@h...> on Sun, 15 Jul 2001 19:10:16 -0600
Is it possible for my PHP page to redirect so that a standard HTML page in a

different folder on my host (Apache) is returned to the user? I'm not

talking about using Jvascript, but rather having it all done on the server.



Here's why. I have two domain names pointing to the same server (I'm cheap).

I would like to look at the domain name that was used (via $HTTP_HOST) and

then return the index page from the folder for the appropriate site. I'm

hoping I can change $PHP_SELF and then somehow use it to send that page back

to the user and that he can surf from there.





Message #2 by Jorge Cordero <jorge@d...> on Mon, 16 Jul 2001 08:03:31 -0600
Try the header function

header("location:pathtomywebpage");

headers must be sent before anyother data.

if need a working example just ask



Jorge Cordero

-----Mensaje original-----

De: MrQuietGuy <mrquietguy@h...>

Grupos de noticias: beginning_php

Para: beginning php <beginning_php@p...>

Fecha: Lunes, 16 de Julio de 2001 02:27 a.m.

Asunto: [beginning_php] PHP Redirect





>Is it possible for my PHP page to redirect so that a standard HTML page in

a

>different folder on my host (Apache) is returned to the user? I'm not

>talking about using Jvascript, but rather having it all done on the server.

>

>Here's why. I have two domain names pointing to the same server (I'm

cheap).

>I would like to look at the domain name that was used (via $HTTP_HOST) and

>then return the index page from the folder for the appropriate site. I'm

>hoping I can change $PHP_SELF and then somehow use it to send that page

back

>to the user and that he can surf from there.

Message #3 by "MrQuietGuy" <mrquietguy@h...> on Mon, 16 Jul 2001 09:43:56 -0600
Thanks Jorge, I'll try it.



"Jorge Cordero" <jorge@d...> wrote in message

news:83340@b..._php...

>

> Try the header function

> header("location:pathtomywebpage");

> headers must be sent before anyother data.

> if need a working example just ask

>

> Jorge Cordero

> -----Mensaje original-----

> De: MrQuietGuy <mrquietguy@h...>

> Grupos de noticias: beginning_php

> Para: beginning php <beginning_php@p...>

> Fecha: Lunes, 16 de Julio de 2001 02:27 a.m.

> Asunto: [beginning_php] PHP Redirect

>

>

> >Is it possible for my PHP page to redirect so that a standard HTML page

in

> a

> >different folder on my host (Apache) is returned to the user





Message #4 by Jorge Cordero <jorge@d...> on Mon, 16 Jul 2001 12:32:37 -0600
Hi MrQuietGuy

you can do a lobby page where the form goes

an then redirect from there that is a lot easier.

<?

require("myconection.php3");

if(something){

header("location:page.htm");

}

if(other){

header("location:getout.htm");

}

.....more of the same

?>

-----Mensaje original-----

De: MrQuietGuy <mrquietguy@h...>

Grupos de noticias: beginning_php

Para: beginning php <beginning_php@p...>

Fecha: Lunes, 16 de Julio de 2001 09:51 a.m.

Asunto: [beginning_php] Re: PHP Redirect





>Thanks Jorge, I'll try it.

>

>"Jorge Cordero" <jorge@d...> wrote in message

>news:83340@b..._php...

>>

>> Try the header function

>> header("location:pathtomywebpage");

>> headers must be sent before anyother data.

>> if need a working example just ask

>>

>> Jorge Cordero

>> -----Mensaje original-----

>> De: MrQuietGuy <mrquietguy@h...>

>> Grupos de noticias: beginning_php

>> Para: beginning php <beginning_php@p...>

>> Fecha: Lunes, 16 de Julio de 2001 02:27 a.m.

>> Asunto: [beginning_php] PHP Redirect

>>

>>

>> >Is it possible for my PHP page to redirect so that a standard HTML page

>in

>> a

>> >different folder on my host (Apache) is returned to the user

>





Message #5 by "MrQuietGuy" <mrquietguy@h...> on Mon, 16 Jul 2001 16:16:07 -0600
I'm not sure what you mean by a lobby page, but I did basically what you

suggested and it works fine --- except ---



The URL in the addressbar is not what I want it to be. It has the address of

the inner folder, which I would rather have omitted.

My basic container site is http://DenverUrbanMinistries.net -- I want to

have several related sites in this space, the first of which in the main

site of http://denum.org.

I want to put my actual web site in an inner folder

http://DenverUrbanMinistries.net/denum

Since this is an active web site, I have made a test file named phptest.php

in the container site.

This test file redirects to the inner folder just fine when I go to

http://denum.org/phptest.php

It falls through to HTML code on the phptest.php page when I go to

http://DenverUrbanMinistries.net/phptest.php -- this is fine also, exactly

what I want.

However, when it redirects, the addres bar shows http://denum.org/denum/ --

I would like to have it show http://denum.org/.

These are working addresses in case you want to check it out.

Is this asking too much? Is it possible?



Tom in Denver



"Jorge Cordero" <jorge@d...> wrote in message

news:83490@b..._php...

>

> Hi MrQuietGuy

> you can do a lobby page where the form goes

> an then redirect from there that is a lot easier.

> <?

> require("myconection.php3");

> if(something){

> header("location:page.htm");

> }

> if(other){

> header("location:getout.htm");

> }

> .....more of the same

> ?>

>

Message #6 by Jorge Cordero <jorge@d...> on Mon, 16 Jul 2001 17:45:24 -0600
what i mean is a page that the only code that is in it is the headers

instructions you have all the instruccion over there when anybody cicks waht

ever they go to that page and they are internally redirected from there

thats the easy an  cleanest way



Jorge

-----Mensaje original-----

De: MrQuietGuy <mrquietguy@h...>

Grupos de noticias: beginning_php

Para: beginning php <beginning_php@p...>

Fecha: Lunes, 16 de Julio de 2001 04:20 p.m.

Asunto: [beginning_php] Re: PHP Redirect





>I'm not sure what you mean by a lobby page, but I did basically what you

>suggested and it works fine --- except ---

>

>The URL in the addressbar is not what I want it to be. It has the address

of

>the inner folder, which I would rather have omitted.

>My basic container site is http://DenverUrbanMinistries.net -- I want to

>have several related sites in this space, the first of which in the main

>site of http://denum.org.

>I want to put my actual web site in an inner folder

>http://DenverUrbanMinistries.net/denum

>Since this is an active web site, I have made a test file named phptest.php

>in the container site.

>This test file redirects to the inner folder just fine when I go to

>http://denum.org/phptest.php

>It falls through to HTML code on the phptest.php page when I go to

>http://DenverUrbanMinistries.net/phptest.php -- this is fine also, exactly

>what I want.

>However, when it redirects, the addres bar shows http://denum.org/denum/ --

>I would like to have it show http://denum.org/.

>These are working addresses in case you want to check it out.

>Is this asking too much? Is it possible?

>

>Tom in Denver

>

>


  Return to Index