Outgoing links on PHP pages, replace with 1 short url ??

Discussion in 'PHP' started by fatabbot, Jun 16, 2007.

  1. #1
    Hi,

    I have some phppages with lots of outgoing links, all pointing to different places.
    I'd like to make something that all url's point to my own domain somewhere and from there on getting directed to the actual destination url. I want to do this to avoid outgoing to many different sites, which is bad for SEO purposes according to some people...
     
    fatabbot, Jun 16, 2007 IP
  2. CodyRo

    CodyRo Peon

    Messages:
    365
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Not quite sure what you mean.. do you mean you want something along the lines of:

    Outgoing link: www.yourdomain.com/?out=123

    then it will redirect to the proper link?
     
    CodyRo, Jun 16, 2007 IP
  3. fatabbot

    fatabbot Well-Known Member

    Messages:
    559
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    138
    #3
    Yep, that's what i mean :)
     
    fatabbot, Jun 17, 2007 IP
  4. dre

    dre Peon

    Messages:
    1,367
    Likes Received:
    24
    Best Answers:
    0
    Trophy Points:
    0
    #4
    You need all links in a db first with an id ;)
     
    dre, Jun 17, 2007 IP
  5. fatabbot

    fatabbot Well-Known Member

    Messages:
    559
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    138
    #5
    Yup, already got that.
     
    fatabbot, Jun 17, 2007 IP
  6. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #6
    So what exactly are you asking for? A script that replaces all URLs in certain files?
     
    nico_swd, Jun 17, 2007 IP
  7. fatabbot

    fatabbot Well-Known Member

    Messages:
    559
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    138
    #7
    No, I just don't want to have links to 50 different domains... So i want to link like with tinyurl.com or something...
     
    fatabbot, Jun 17, 2007 IP
  8. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #8
    Okay, but what do you want us to do? You have these links in your pages. Why not edit them? It's not clear what you're asking for... Do you need the outgoing page that actually redirects?

    
    
    <?php
    
    if (isset($_GET['id']))
    {
        $query = mysql_query("SELECT url FROM links WHERE linkid = ". intval($_GET['id'])) OR die(mysql_error());
    
        if (mysql_num_rows($query))
        {
             $link = mysql_fetch_assoc($query);
    
             header('Location: ' . $link['url']);
        }
    }
    
    ?>
    
    PHP:
     
    nico_swd, Jun 17, 2007 IP
  9. fatabbot

    fatabbot Well-Known Member

    Messages:
    559
    Likes Received:
    10
    Best Answers:
    0
    Trophy Points:
    138
    #9
    No, that just places all the links on the page, with all different domains...
    Yes i want to point to a page like:

    mysite.com/page-to-use-to-point-to-all-over-the-site.php?destination=http://www.realdestinationurl.com/

    Something like that :)
     
    fatabbot, Jun 17, 2007 IP