Hide or alter links

Discussion in 'PHP' started by Mr.Bill, Mar 14, 2008.

  1. #1
    I am looking for someone to tell me how to do this but rather tell me the technical term for what I would like to do. THis way I can attempt to research it.

    I have a directory and when links are added they show in a list like this

    www.example.com
    www.example.com
    www.example.com

    Now I DO not what this to end up being a link farm so I want to some how make it so the links would show like this

    www.example.com { on mouse over} http://www.mysite.com/submitted.php?url=www.example.com

    Hope this made sense :)
     
    Mr.Bill, Mar 14, 2008 IP
  2. Christian Little

    Christian Little Peon

    Messages:
    1,753
    Likes Received:
    80
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Lookup the window.status javascript function, that will do what you want.
     
    Christian Little, Mar 14, 2008 IP
  3. Mr.Bill

    Mr.Bill Well-Known Member

    Messages:
    2,818
    Likes Received:
    134
    Best Answers:
    0
    Trophy Points:
    160
    #3
    Let me change how I said that at current the links look like this

    had to add a space kept messing up the url


    Now of course that wont work I need some how that when they click the link they are sent to http://www.example.com. I am guessing something on the "submitted.php" page would strip the "
    http://www.mysite.com/submitted.php?url=" part and send them on there merry way to the location they picked.
     
    Mr.Bill, Mar 14, 2008 IP
  4. stoli

    stoli Peon

    Messages:
    69
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    0
    #4
    In its simplest case the 'submitted.php' file would look something like:
    <?php
      header("Location: http://".$_GET['url']);
    ?>
    PHP:
    I am not sure why you would want to do this though. Users can see where the redirect is going and search engines can follow it.

    If you want to hide it from users, then you would need to pass a variable (instead of the URL) to 'submitted.php'.

    If you want to hide it from search engines then you would need to put an appropriate directive in your 'robots.txt' file.
     
    stoli, Mar 14, 2008 IP
  5. Mr.Bill

    Mr.Bill Well-Known Member

    Messages:
    2,818
    Likes Received:
    134
    Best Answers:
    0
    Trophy Points:
    160
    #5
    This is so there link wont be a "backlink"

    I will end up hiring someone at the end of the month. I am looking to have the links look like the ones in the form box of this site and work the same way. Instead of looking like the ones on this site
     
    Mr.Bill, Mar 14, 2008 IP
  6. AdnanAhsan

    AdnanAhsan Well-Known Member

    Messages:
    601
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    110
    #6
    just use mod_rewrite rule in your .htaccess, simple is that:) have fun
     
    AdnanAhsan, Mar 15, 2008 IP
  7. LittleJonSupportSite

    LittleJonSupportSite Peon

    Messages:
    386
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Why not just make an entire ReWrite for all your articles.
    I mean you can get nasty with mysql and have it make calls on every request but I think .htaccess and using Url Rewrites would do it.

    not sure of the load you have but thats How I would go about it.....
     
    LittleJonSupportSite, Mar 15, 2008 IP
  8. stoli

    stoli Peon

    Messages:
    69
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    0
    #8
    The site you use as an example does have its links counted as backlinks.

    If you go to google.com and enter the following search:
    link:http://www.transactional.com
    Code (markup):
    then you should see 'www.xgxi.com/top25.php' listed as one of the results. That is because the link to transactional.com has been followed and counted by Google.

    The only way you can stop the links being counted as backlinks is by either adding 'nofollow' as the value of the 'rel' attribute to you anchor tags, like this:
    
    <a href="count_hits.php?url=http://www.transactional.com" target="_blank" rel="nofollow">http://www.transactional.com</a>
    HTML:
    or preferably by adding a disallow directive in your 'robots.txt' file for the page on your site that contains the links. Do that by creating a file named 'robots.txt' in the document root of your web site, with for example:
    
    User-agent: *
    Disallow: /top25.php
    Code (markup):
    change the page that you want to disallow as appropriate.

    That will keep the links out of the search engines.

    Judging by the fact that the name of the script doing the redirection on xgxi.com is 'count_hits.php' I would say they use this to count how many times each link gets clicked and is nothing to do with trying to stop the links being seen as backlinks.
     
    stoli, Mar 16, 2008 IP
  9. Mr.Bill

    Mr.Bill Well-Known Member

    Messages:
    2,818
    Likes Received:
    134
    Best Answers:
    0
    Trophy Points:
    160
    #9
    right but the is from top25.php and not the index.php :) no worries I will employ someone to change the code on the site I need fixed,
     
    Mr.Bill, Mar 16, 2008 IP
  10. stoli

    stoli Peon

    Messages:
    69
    Likes Received:
    14
    Best Answers:
    0
    Trophy Points:
    0
    #10
    The link on top25.php is the same as the one on index.php. It links to 'count_hits.php?url=http://www.transactional.com'. There is just an additional one in the content of the page as well as the side bar. The only reason top25.php is listed instead of index.php is probably because there are two links.

    Like I said if you don't want links to be counted as back links you have to tell the search engines not to count them. To do that use a robots meta tag, a robots.txt file or rel="nofollow" attribute.
     
    stoli, Mar 16, 2008 IP
  11. Mr.Bill

    Mr.Bill Well-Known Member

    Messages:
    2,818
    Likes Received:
    134
    Best Answers:
    0
    Trophy Points:
    160
    #11
    Thank you I have added the nofollow attribute to the links
     
    Mr.Bill, Mar 16, 2008 IP