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
301 Redirect with text on the page
Old 08-06-2010, 05:21 AM 301 Redirect with text on the page
etrader's Avatar
Experienced Talker

Posts: 37
Trades: 0
I want to redirect a page to an external website by a simple php code; the best solution is

Quote:
<?
Header( "HTTP/1.1 301 Moved Permanently" );
Header( "Location: http://www.new-url.com" );
?>
but the problem is that I need to add a php tracking code to have a track of the visitors to my page. But this simple 301 does not work when there is something before that.

I need a simple php redirect code to be written after tracking code in a page.
__________________

Please login or register to view this content. Registration is FREE
etrader is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 08-06-2010, 08:15 AM Re: 301 Redirect with text on the page
phpdasan's Avatar
Experienced Talker

Posts: 37
Name: Karthick B
Trades: 0
may be this helps

Get the visitor's IP

if (IP not in database)
{
Insert the IP into the database
}

Show some message to the visitor, stating they being redirected..

Header( "Location: http://www.new-url.com" );
__________________
There is no secret ingredient.
phpdasan is offline
Reply With Quote
View Public Profile
 
Old 08-06-2010, 10:29 AM Re: 301 Redirect with text on the page
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,384
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Quote:
Originally Posted by phpdasan View Post
may be this helps
Show some message to the visitor, stating they being redirected..

Header( "Location: http://www.new-url.com" );
You CANNOT display a message then redirect, as HTTP headers cannot be sent to a useragent AFTER output has started!
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 08-06-2010, 01:30 PM Re: 301 Redirect with text on the page
phpdasan's Avatar
Experienced Talker

Posts: 37
Name: Karthick B
Trades: 0
Oops.. sorry for that

After showing the message redirect using javascript.

<script>
window.location.href = "http://www.new-url.com";
</script>

or you do'nt want the message to display,

Simply redirect with PHP header function.
__________________
There is no secret ingredient.
phpdasan is offline
Reply With Quote
View Public Profile
 
Old 08-06-2010, 06:19 PM Re: 301 Redirect with text on the page
etrader's Avatar
Experienced Talker

Posts: 37
Trades: 0
I am looking for a form of redirection code that works with other php codes on the page

Something like

Quote:
<? my php tracking code ?>

<? redirecting code ?>
So when browsing this page, the visitor will be tracked by the first php code, and the second php code simply redirects to the target page.
__________________

Please login or register to view this content. Registration is FREE
etrader is offline
Reply With Quote
View Public Profile
 
Old 08-06-2010, 06:30 PM Re: 301 Redirect with text on the page
chrishirst's Avatar
Missing! presumed drunk.

Posts: 42,384
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
As in post #2

store the information in a database then redirect.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Reply     « Reply to 301 Redirect with text on the page
 

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 0.29741 seconds with 12 queries