Open previous links in a new window

Discussion in 'HTML & Website Design' started by pinkytoe, Sep 11, 2013.

  1. #1
    I am looking for a way to open all links on my site in a new window. The problem is I have thousands of external links and I would like to retroactively make them open using target="_blank" HTML.

    I was wondering if there as a quick way to do this using .htaccess file or maybe something in the header.php file?

    I have considered the search and replace plugin but would like to use a differnt approach if it turns out to be easier.
     
    pinkytoe, Sep 11, 2013 IP
  2. george saviola

    george saviola Peon

    Messages:
    24
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    1
    #2
    Why dont u change the code?
    With replace, make a replacement like : replace : <a href=" to <a target="_blank" href="

    I dont think you can make this through .htaccess
     
    george saviola, Sep 26, 2013 IP
  3. undergroundseo

    undergroundseo Active Member

    Messages:
    121
    Likes Received:
    3
    Best Answers:
    1
    Trophy Points:
    73
    #3
    Yeah if you open on of the files which you want to replace in dreamweaver you will be able to do a find and replace items using a batch script within a specified folder. It will do it all automatically for you.
     
    undergroundseo, Sep 26, 2013 IP
  4. kip

    kip Notable Member

    Messages:
    1,521
    Likes Received:
    80
    Best Answers:
    0
    Trophy Points:
    205
    #4
    Just add this in your header: <base href="http://www.yourwebsite.com/" target="_blank"> This will change all links to open in a new tab. Change your website to your website of course. No need to change hundreds of instances
     
    kip, Sep 26, 2013 IP