redirecting in php

Thread Solved

Join Date: Oct 2006
Posts: 942
Reputation: ardav will become famous soon enough ardav will become famous soon enough 
Solved Threads: 125
ardav's Avatar
ardav ardav is offline Offline
Posting Shark
 
0
  #11
21 Days Ago
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; 21 Days Ago at 1:12 pm.
"...the woods would be a very silent place if no birds sang except for the best"
All opinions count.
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
21 Days Ago
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: 90
Reputation: sam023 is an unknown quantity at this point 
Solved Threads: 2
sam023 sam023 is online now Online
Junior Poster in Training
 
-1
  #13
20 Days Ago
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; 20 Days Ago at 5:39 am.
Reply With Quote Quick reply to this message  
Join Date: Oct 2009
Posts: 8
Reputation: foxwizzy is an unknown quantity at this point 
Solved Threads: 1
foxwizzy foxwizzy is offline Offline
Newbie Poster
 
0
  #14
20 Days Ago
  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
20 Days Ago
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
20 Days Ago
@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
20 Days Ago
@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
20 Days Ago
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: 942
Reputation: ardav will become famous soon enough ardav will become famous soon enough 
Solved Threads: 125
ardav's Avatar
ardav ardav is offline Offline
Posting Shark
 
0
  #19
20 Days Ago
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().
"...the woods would be a very silent place if no birds sang except for the best"
All opinions count.
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
20 Days Ago
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
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC