Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 10 of 10
  1. #1
    New Coder
    Join Date
    Sep 2006
    Location
    Leeuwarden, Friesland
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Script to block external link to website

    Not sure if this is the right place for this question, but is there some script with which you can block links from specific websites to your website? Websites from which you would rather not be linked from?

    Thanks in advance,
    Maurice

  • #2
    Regular Coder croatiankid's Avatar
    Join Date
    Jan 2006
    Posts
    665
    Thanks
    1
    Thanked 12 Times in 12 Posts
    You can't prevent people from linking to your site, but you could probably use php to check the referrer header, and based on it, redirect them to somewhere else.

  • #3
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    .htaccess might be better for this. Create a file called htaccess.txt

    Put this in it
    Code:
    order allow,deny
    deny from .theirdomain.com
    allow from all
    Change theirdomain.com to the domain you wish to block, and then upload the file and rename it using your ftp program to .htaccess (no extension).
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #4
    New Coder
    Join Date
    Sep 2006
    Location
    Leeuwarden, Friesland
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thanks for the replies. I wouldn't know how to do this - php to check the referrer header - and the htaccess doesn't seem to be working

    The problem is with Wikipedia, the link to a subpage of my website that is then loaded outside the main page (inline frame).

    This kind of vandalism (how else can you call ripping someone's work apart like that) is exactly the reason why I started using an inline frame with a "stay in frame" script, that in every other case seems to be working just fine (try to open a subpage in another window and you are redirected to the main page), but with Wikipedia it doesn't

    What to do, what to do.....

    Greetings,
    Maurice
    Last edited by MauriceB; 06-04-2007 at 10:33 PM.

  • #5
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    I see so they linked to your page that is supposed to be in a frame. I see you have tried to use javascript already. Can you post the wikipedia thats doing this? Can you not just remove the link? Wikipedias usually are editable.
    Last edited by _Aerospace_Eng_; 06-04-2007 at 10:58 PM.
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #6
    New Coder
    Join Date
    Sep 2006
    Location
    Leeuwarden, Friesland
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I've tried that, 10 minutes later the link was put back, deleted it again, explained why, then I got told to just go and delete my website if I didn't want to be linked from Wikipedia. I've send an email with a complaint to who ever is in charge of Wikipedia NL.

    Meanwhile, could they be using some sort of script that overrules my script?

  • #7
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    I don't know which is why I asked you to post the wikipedia link to begin with.
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #8
    New Coder
    Join Date
    Sep 2006
    Location
    Leeuwarden, Friesland
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Yes, I forgot, sorry. Here's the link:

    http://nl.wikipedia.org/wiki/Deor

    The 4th external link is to my website, or at least part of it.

  • #9
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    The javascript you tried has no effect on the document. Did you try writing that yourself? I suggest you use something that actually works. To explain what they are doing. This is your javascript
    Code:
    <script type="text/javascript">
    <!--
    if (top.location.href.indexOf("index.html") == -1){
    top.location.href = "../index.html?teksten/deor.htm"
    }
    // -->
    </script>
    The only thing that is doing is looking for index.html in the url. If it finds it then nothing happens. The link they are using has ?index.html on it so the javascript you are using finds index.html so nothing happens. Try the script found here
    http://www.javascriptkit.com/script/...epframes.shtml
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #10
    New Coder
    Join Date
    Sep 2006
    Location
    Leeuwarden, Friesland
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hmm, that's odd. I didn't write it myself, I'm not a script writer. Someone from this forum pointed me to this script, if I am not mistaken. It comes together with a code in the main indexpage.

    But I will try the script you gave this evening when I am back home.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •