redirecting in php

Thread Solved

Join Date: Oct 2006
Posts: 1,102
Reputation: ardav will become famous soon enough ardav will become famous soon enough 
Solved Threads: 139
ardav's Avatar
ardav ardav is offline Offline
Veteran Poster
 
-1
  #11
Nov 2nd, 2009
Do any of your php pages show as "proper webpages" in FF? It's just possibel that the Apache webserver, although installed, is not on. I am not familiar with WAMP (I use XAMPP), but I assume it has a control panel - check to see if Apache is on.

In addition, perhaps it would be useful to check your hosts and vhosts files - usually something like this):

C:\Windows\System32\drivers\etc\hosts
C:\xampp\apache\conf\extra\httpd-vhosts.conf (yours will probably be under some sort of wamp directory).

The hosts file (note no file extension) should contain something like:

127.0.0.1 localhost
::1 localhost
The other file should contain something like:

NameVirtualHost 127.0.0.1
These files are where you'd add your virtual local sites


//EDIT

Just looked over the first couple of posts again:


  1. header('Location:http://www.yahoo.com');

If the above won't work, it's not because you can't find the localhost through the header command, it's probably because php won't run at all in this location (localhost).

Can you run a simple

  1. echo "hello world!";

page?
Last edited by ardav; Nov 2nd, 2009 at 1:12 pm.
If you don't reply to your own thread or you can't find the solved link - you're off my Christmas list - permanently! Bah humbug!
Reply With Quote Quick reply to this message  
Join Date: Oct 2009
Posts: 12
Reputation: rokape is an unknown quantity at this point 
Solved Threads: 1
rokape rokape is offline Offline
Newbie Poster
 
0
  #12
Nov 2nd, 2009
make a file called phpinfo.php with the folowing code:

  1. <?php
  2. phpinfo();
  3. ?>

Now if PHP is installed & working correctly, you should see a load of data & variables in a table with a purple background. If not, something is wrong with your PHP/Apache install.

Joshhh
Reply With Quote Quick reply to this message  
Join Date: Jun 2009
Posts: 121
Reputation: sam023 is an unknown quantity at this point 
Solved Threads: 2
sam023 sam023 is offline Offline
Junior Poster
 
-1
  #13
Nov 3rd, 2009
Try this
  1. <?php
  2. header("Location:yahoo.com");
  3. ?>

it can be possible that short tags are off in php.ini. So Try once the above code.!!
Last edited by sam023; Nov 3rd, 2009 at 5:39 am.
Reply With Quote Quick reply to this message  
Join Date: Oct 2009
Posts: 9
Reputation: foxwizzy is an unknown quantity at this point 
Solved Threads: 1
foxwizzy foxwizzy is offline Offline
Newbie Poster
 
0
  #14
Nov 3rd, 2009
  1. <meta http-equiv="refresh" content="1; URL=http://yahoo.com">
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 61
Reputation: Manuz is an unknown quantity at this point 
Solved Threads: 8
Manuz's Avatar
Manuz Manuz is offline Offline
Junior Poster in Training
 
0
  #15
Nov 3rd, 2009
Lets Try This ...
1. "L" MUST BE CAPITAL
2. Provide a space as i mentioned below ,this will be useful for IE
1.
<?
header("Location: index.html");
?>
Sharing Knowledge Is Better Than Any Other Thingz
Reply With Quote Quick reply to this message  
Join Date: Jul 2009
Posts: 45
Reputation: AirGear is an unknown quantity at this point 
Solved Threads: 2
AirGear AirGear is offline Offline
Light Poster
 
0
  #16
Nov 3rd, 2009
@ardav : i have installed xampp now, thought that something's wrong with wamp. but everything is still the same. i have checked those files, the one in win32 is okay, but i can't find "NameVirtualHost 127.0.0.1" in httpd-vhosts.conf. what should i do? anyway, i installed xampp in c/program files/xampp not in c/xampp, is it okay? and i can run simple php file like that hello world.

@rokape : yes, it works. seems nothing's wrong with my php installed here. thanks for your response.

@sam023, manus : they all don't work, still leads to a blank page

@foxwizzy : you mean i must write it like this?
  1. <?
  2. echo "<meta http-equiv="refresh" content="1; URL=http://yahoo.com">";
  3. ?>

but i only get this in my page
"; ?>
Reply With Quote Quick reply to this message  
Join Date: Jul 2009
Posts: 45
Reputation: AirGear is an unknown quantity at this point 
Solved Threads: 2
AirGear AirGear is offline Offline
Light Poster
 
0
  #17
Nov 3rd, 2009
@foxwizzy : oh sorry, i wrote it in wrong way. yeah it works. but i have to add some php code in this file. can i do this, create this file as html file, and add <?php code blablabla ?> inside it?
Reply With Quote Quick reply to this message  
Join Date: Oct 2009
Posts: 12
Reputation: rokape is an unknown quantity at this point 
Solved Threads: 1
rokape rokape is offline Offline
Newbie Poster
 
0
  #18
Nov 3rd, 2009
You only get that because you used a " inside your echo string not ' or an escaped /".

This concludes that your install isnt working because otherwise this would error, unexpected t var etc.
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 1,102
Reputation: ardav will become famous soon enough ardav will become famous soon enough 
Solved Threads: 139
ardav's Avatar
ardav ardav is offline Offline
Veteran Poster
 
-1
  #19
Nov 3rd, 2009
I shouldn't have thought it would make much difference, but have you included an

  1. exit;
on the next line after the header() statement?

In addition, make sure there is no html output including any white space before the header().
If you don't reply to your own thread or you can't find the solved link - you're off my Christmas list - permanently! Bah humbug!
Reply With Quote Quick reply to this message  
Join Date: Jul 2009
Posts: 45
Reputation: AirGear is an unknown quantity at this point 
Solved Threads: 2
AirGear AirGear is offline Offline
Light Poster
 
0
  #20
Nov 3rd, 2009
you mean this?
  1. <?
  2. session_destroy();
  3. header("location:index.html");
  4. exit;
  5. ?>

i have tried that and nothing happens again
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:



Other Threads in the PHP Forum


Views: 1361 | Replies: 30
Thread Tools Search this Thread



Tag cloud for PHP
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC