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 9 of 9
  1. #1
    New to the CF scene
    Join Date
    Oct 2002
    Location
    NYC
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    codes to prevent off site linking

    Hi, the title pretty much gives away what I'm looking for. I've searchd a little but couldn't find it.

    Does anyone know the code for HTML to prevent ppl from off site linking pictures, etc. ???

    Thanks

    -- alovelyhug
    Last edited by WA; 11-12-2005 at 07:52 PM.

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Location
    NL
    Posts
    421
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Ilayda, hi,
    you can't do that with HTML. Well you can by changing the names of your images every day but there is another solution.
    .htaccess.
    Here's a tutorial: http://www.wsabstract.com/howto/htaccess.shtml


    If it's about the site in your profile, this is what you need. Prevents hotlinking and redirects to your main page (from places like Google's image search).

    Code:
    RewriteEngine On
    RewriteCond %{HTTP_REFERER} !^$
    RewriteCond %{HTTP_REFERER} !^http://www.mysite.com/.*$ [NC]
    RewriteCond %{HTTP_REFERER} !^http://mysite.com/.*$ [NC]
    RewriteCond %{HTTP_REFERER} !^http://www.mysite.com:80/.*$ [NC]
    RewriteCond %{HTTP_REFERER} !^http://mysite.com:80/.*$ [NC]
    RewriteCond %{HTTP_REFERER} !^http://11.22.33.44/.*$ [NC]
    RewriteCond %{HTTP_REFERER} !^http://11.22.33.44:80/.*$ [NC]
    RewriteRule .*\.(jpg|JPG|gif|GIF)$ http://mysite.com/index.html [R,L]
    Last edited by WA; 11-08-2005 at 04:11 AM.

  • #3
    New to the CF scene
    Join Date
    Oct 2002
    Location
    NYC
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi and thanks MCookie

    Yes, it is for my site and mostly for images, and I'm not sure what redirects mean? when someone is linking to my site?

    I'll try your code and take a look at that site.

    One question still, where exactly do I put the code? Head/body tag? or does it not matter where?

    -- alovelyhug

    edit: oh i'm sorry, I got what you meant with redirecting , my bad !
    Last edited by WA; 11-12-2005 at 07:52 PM.

  • #4
    Regular Coder
    Join Date
    Jun 2002
    Location
    NL
    Posts
    421
    Thanks
    0
    Thanked 0 Times in 0 Posts
    >> where exactly do I put the code? Head/body tag? or does it not matter where?

    Yes, it does matter where you put it... no, don't put it in anywhere in your page. It's not supposed to be on any page but in a file called .htaccess. Changing server settings..
    So be sure to read the tutorial before copy-pasting anything... http://www.wsabstract.com/howto/htaccess.shtml

  • #5
    New to the CF scene
    Join Date
    Oct 2002
    Location
    NYC
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    *moans*

    oh God. I thought it was easier.

    I'll try it anyway.

    thank you so much for your help

    -- alovelyhug
    Last edited by WA; 11-12-2005 at 07:52 PM.

  • #6
    Regular Coder
    Join Date
    Jun 2002
    Location
    NL
    Posts
    421
    Thanks
    0
    Thanked 0 Times in 0 Posts
    *sigh*

    Easier?
    Well you don't have to study regular expressions to copy, paste and upload. It's just a file with 9 lines of code

  • #7
    New to the CF scene
    Join Date
    Oct 2002
    Location
    NYC
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    *pouts*
    hey, I'm not a pro like you

    5 months ago html, etc, was a mystery to me so bear with me. First off, I have to read the tutorial to find out how or where that file is.

  • #8
    Senior Coder Nightfire's Avatar
    Join Date
    Jun 2002
    Posts
    4,265
    Thanks
    6
    Thanked 48 Times in 48 Posts
    There's no need to look for the file

    Open notepad, paste the above code into it. Save it as .htaccess then simply upload to your site.

  • #9
    New to the CF scene
    Join Date
    Oct 2002
    Location
    NYC
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Okay, thank you Nightfire (nice sn btw) . I'll try that tonight

    -- alovelyhug
    Last edited by WA; 11-12-2005 at 07:52 PM.


  •  

    Posting Permissions

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