Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Old 11-06-2010, 12:20 AM php Redirect
Junior Talker

Posts: 2
Trades: 0
I know asp better, but php... I found some solutions on the php redirect, but i do not know which one is the better. Can you give me some advices?
http://www.webmaster-talk.com as an example

-------------Header---------------
<?php
$url = http://www.webmaster-talk.com;
if (isset($url))
{
Header("Location: $url");
}
?>
------------java script-------------------
<? php
$url=http://www.webmaster-talk.com;
echo "<SCRIPT LANGUAGE=\"java script\">location.href='$url'</SCRIPT>";
?>
londeed is offline
Reply With Quote
View Public Profile Visit londeed's homepage!
 
 
Register now for full access!
Old 11-06-2010, 07:27 AM Re: php Redirect
NullPointer's Avatar
Will Code for Food

Posts: 2,815
Name: Matt
Location: Irvine, CA
Trades: 0
Neither is better or worse; they're just different.

If you call header('Location:...') in PHP the server will issue a 302 redirect to the user. You should use this if you need to redirect a user without displaying any content first.

Using javascript, the user won't be redirected until after the content of the site is downloaded. This allows you to display a message to the user (use setTimeout to delay the redirect). Obviously the user must have javascript enabled for this to work.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
NullPointer is online now
Reply With Quote
View Public Profile Visit NullPointer's homepage!
 
Reply     « Reply to php Redirect
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 1.07400 seconds with 12 queries