How to put NOFOLLOW on a block of links without editing all of the links ?

Discussion in 'PHP' started by poseidon, Oct 10, 2007.

  1. #1
    I have several pages of links and I want to make them all NOFOLLOW. Now I can manually add ref=nofollow but that will be too time consuming. Can I do it using programaically with javascript or php ?

    Cheers
     
    poseidon, Oct 10, 2007 IP
  2. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #2
    Where do these links come from? A database? Or are they directly coded into the page? Got a link to it? Examples?
     
    nico_swd, Oct 10, 2007 IP
  3. FFMG

    FFMG Well-Known Member

    Messages:
    1,091
    Likes Received:
    39
    Best Answers:
    0
    Trophy Points:
    160
    #3
    Something like

    
    $text = preg_replace('~<a (.+?)>~i', '<a $1 rel="nofollow">', $text);
    
    Code (markup):
    Works for me.

    FFMG
     
    FFMG, Oct 10, 2007 IP
  4. North Carolina SEO

    North Carolina SEO Well-Known Member

    Messages:
    1,327
    Likes Received:
    44
    Best Answers:
    0
    Trophy Points:
    105
    #4
    North Carolina SEO, Oct 10, 2007 IP
  5. tobto

    tobto Peon

    Messages:
    36
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    I suppose there is some way to do that with help of DOM, but never met it
     
    tobto, Dec 29, 2007 IP