silent redirect using php

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
thewebdrivers
Forum Commoner
Posts: 41
Joined: Fri Aug 17, 2007 3:32 pm
Location: india
Contact:

silent redirect using php

Post by thewebdrivers »

Hello there,

I don't know if this is possible or not but i want to make a silent redirect from one page to other based on condition specified in php code. I do not want the page url to change when redirecting. Since the condition is based in php code, i cannot use .htaccess

Any ideas? thanks in advance.

Regards

Mike
michaelh613
Forum Commoner
Posts: 38
Joined: Sun Mar 16, 2008 1:35 pm

Re: silent redirect using php

Post by michaelh613 »

thewebdrivers wrote:Hello there,

I don't know if this is possible or not but i want to make a silent redirect from one page to other based on condition specified in php code. I do not want the page url to change when redirecting. Since the condition is based in php code, i cannot use .htaccess

Any ideas? thanks in advance.

Regards

Mike
For example
header("Location: urlyouwantto use");

It's in the documentation here

http://us3.php.net/header
thewebdrivers
Forum Commoner
Posts: 41
Joined: Fri Aug 17, 2007 3:32 pm
Location: india
Contact:

Re: silent redirect using php

Post by thewebdrivers »

that will change the address bar, I do not want to change address bar and want to silently redirect to a new page.
anto91
Forum Commoner
Posts: 58
Joined: Mon Mar 10, 2008 10:59 am
Location: Sweden

Re: silent redirect using php

Post by anto91 »

Define silently, because if you want to edit the contents of the page in realtime you will need to use ajax
thewebdrivers
Forum Commoner
Posts: 41
Joined: Fri Aug 17, 2007 3:32 pm
Location: india
Contact:

Re: silent redirect using php

Post by thewebdrivers »

by silently, i meant redirecting to a different page without changing the url. i don't think its possible using php code so i have used includes and that did the job. anyways thanks for your help!!
Frank Shi
Forum Newbie
Posts: 6
Joined: Thu Mar 13, 2008 4:03 am

Re: silent redirect using php

Post by Frank Shi »

use imframe. I think it suit your qualifications
thewebdrivers wrote:by silently, i meant redirecting to a different page without changing the url. i don't think its possible using php code so i have used includes and that did the job. anyways thanks for your help!!
User avatar
Jonah Bron
DevNet Master
Posts: 2764
Joined: Thu Mar 15, 2007 6:28 pm
Location: Redding, California

Re: silent redirect using php

Post by Jonah Bron »

Insert at first line of page:

Code: Select all

<?php
include('otherpage.php');
die();
?>
thewebdrivers
Forum Commoner
Posts: 41
Joined: Fri Aug 17, 2007 3:32 pm
Location: india
Contact:

Re: silent redirect using php

Post by thewebdrivers »

i already overcame my problem. i used includes as i said. :-)

Thanks all for your help.
Post Reply