Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

php redirection

5:43 am on Aug 24, 2004 (gmt 0)

Junior Member

10+ Year Member

joined:May 29, 2004
votes: 0

I am vaguely familiar with php, but not efficent enough to get this added to my site, but wish to have something like this.

What I want to do is when someone (me, a visitor, anyone) posts for example "Amazon" www.amazon/deal/affiliate-id , I would like to override it with my affiliate link. I'm not sure if this also has to do with linking words such as whenever someone posts the word "Amazon" it is automatically hyperlinked with my affiliate link.

and when you hover over the links (to the deal) it shows his address /****.php? and THEN to the deal, which somehow switched the "member who posted it" link to the owner of the site's links.

Also, I would need to customize this to include a dozen or so sites.

Is this easy to write and add? All advice would be greatly appreciated. Thanks!

[edited by: jatar_k at 5:45 pm (utc) on Aug. 24, 2004]
[edit reason] removed urls [/edit]

11:53 am on Aug 24, 2004 (gmt 0)

New User

10+ Year Member

joined:Aug 22, 2004
votes: 0

You can use the str_replace function

$replacement_post = str_replace('Amazon', '<a href="http://www.amazon/deal/affiliate-id">Amazon</a>', $post);


11:54 pm on Aug 29, 2004 (gmt 0)

Full Member

10+ Year Member

joined:June 6, 2003
votes: 0

What I like to do is start my template code with an ob_start(), then at the end of the template (after it's replaced template locations with data), I can do any number of str_replaces into the output buffer before sending to the user.

That way it's not limited to just some posts, but anytime "amazon" is mentioned.

Just be careful that you don't replace text within meta tags, title tags, etc.