944,199 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Marked Solved
  • Views: 2174
  • PHP RSS
You are currently viewing page 2 of this multi-page discussion thread; Jump to the first page
Nov 2nd, 2009
-1
Re: redirecting in php
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:

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

Quote ...
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:


PHP Syntax (Toggle Plain Text)
  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

PHP Syntax (Toggle Plain Text)
  1. echo "hello world!";

page?
Last edited by ardav; Nov 2nd, 2009 at 1:12 pm.
Sponsor
Featured Poster
Reputation Points: 1067
Solved Threads: 954
Disgraced Poster
ardav is offline Offline
6,730 posts
since Oct 2006
Nov 2nd, 2009
0
Re: redirecting in php
make a file called phpinfo.php with the folowing code:

php Syntax (Toggle Plain Text)
  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
Reputation Points: 9
Solved Threads: 2
Light Poster
rokape is offline Offline
36 posts
since Oct 2009
Nov 3rd, 2009
-1
Re: redirecting in php
Try this
php Syntax (Toggle Plain Text)
  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.
Reputation Points: 11
Solved Threads: 6
Junior Poster
sam023 is offline Offline
164 posts
since Jun 2009
Nov 3rd, 2009
0
Re: redirecting in php
PHP Syntax (Toggle Plain Text)
  1. <meta http-equiv="refresh" content="1; URL=http://yahoo.com">
Reputation Points: 10
Solved Threads: 2
Newbie Poster
foxwizzy is offline Offline
17 posts
since Oct 2009
Nov 3rd, 2009
0
Re: redirecting in php
Lets Try This ...
1. "L" MUST BE CAPITAL
2. Provide a space as i mentioned below ,this will be useful for IE
Quote ...
1.
<?
header("Location: index.html");
?>
Reputation Points: 12
Solved Threads: 24
Junior Poster
Manuz is offline Offline
122 posts
since Oct 2008
Nov 3rd, 2009
0
Re: redirecting in php
@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?
PHP Syntax (Toggle Plain Text)
  1. <?
  2. echo "<meta http-equiv="refresh" content="1; URL=http://yahoo.com">";
  3. ?>

but i only get this in my page
"; ?>
Reputation Points: 10
Solved Threads: 2
Junior Poster in Training
AirGear is offline Offline
62 posts
since Jul 2009
Nov 3rd, 2009
0
Re: redirecting in php
@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?
Reputation Points: 10
Solved Threads: 2
Junior Poster in Training
AirGear is offline Offline
62 posts
since Jul 2009
Nov 3rd, 2009
0
Re: redirecting in php
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.
Reputation Points: 9
Solved Threads: 2
Light Poster
rokape is offline Offline
36 posts
since Oct 2009
Nov 3rd, 2009
-1
Re: redirecting in php
I shouldn't have thought it would make much difference, but have you included an

PHP Syntax (Toggle Plain Text)
  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().
Sponsor
Featured Poster
Reputation Points: 1067
Solved Threads: 954
Disgraced Poster
ardav is offline Offline
6,730 posts
since Oct 2006
Nov 3rd, 2009
0
Re: redirecting in php
you mean this?
PHP Syntax (Toggle Plain Text)
  1. <?
  2. session_destroy();
  3. header("location:index.html");
  4. exit;
  5. ?>

i have tried that and nothing happens again
Reputation Points: 10
Solved Threads: 2
Junior Poster in Training
AirGear is offline Offline
62 posts
since Jul 2009

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: session in php
Next Thread in PHP Forum Timeline: Multiple file upload through an array





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC