Advanced Search

Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: .htaccess problem

  1. #1
    Join Date
    Jan 2006
    Posts
    18
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Question .htaccess problem

    I'm not sure if anyone has that same problem or posted it here before me but I searched the net and null! I have made a page using ajax java and all that web page in web page tricks but now I want to protect images etc adding .htaccess to the folders. The thing is that I want all those pics to be shown when someone enters from index.html or a page within my site and frobid users to type the path in explorer to view images and sounds... Can this be done with .htaccess? If yes how?

  2. #2
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,878
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    It cannot be done, full stop. If you publish the images, then they can be copied, saved, whatever. Copyright them.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  3. #3
    Join Date
    Jan 2006
    Posts
    18
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    but I've seen websites which publish images but when you type the image's link it displays Forbidden you cannot enter this folder etc. How do they do that?

  4. #4
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,878
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    It's called hotlink protection. The idea is to stop other sites stealing your bandwidth by display images hosted on your server. It's not a form of copy protection, and shouldn't be mistaken as such.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  5. #5
    Join Date
    Jan 2006
    Posts
    18
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    So how does this work? What should I do? Get in touch with my web hosts and have them make that protection or do I have to create it?

  6. #6
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,878
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    It would look something like this:
    Code:
    RewriteEngine on
    RewriteCond %{HTTP_REFERER} !^http://(www\.)?yourdomain.com/.*$      [NC]
    RewriteCond %{HTTP_REFERER} !^http://yourdomain.com$      [NC]
    RewriteRule .*\.(jpg|jpeg|gif|png|bmp)$ - [F,NC]
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  7. #7
    Join Date
    Jan 2006
    Posts
    18
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    this would work on my online site and allow the images to be viewed only within my site right? But how can I modify those lines to work for apache (I test my page before uploading it so I wanted to test it on http://localhost/folder/) The thing is that I want images sounds etc work on my page only when activated by a link or java image viewer but if someone places the folder's url in the browser, they will be prompted that they do not have access. I'm knda new to this and I'm not quite sure how this is possible. I tried the lines you gave me but then the images could not be viewed from java image viewer...
    Last edited by feeleash; 05-19-2006 at 03:31 PM.

  8. #8
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,878
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Aaah, I see. Just the folder's URL. In that case, simply remove read permission from the folders. Leave execute permission on, however.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  9. #9
    Join Date
    Jan 2006
    Posts
    18
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    Read perimission? I must bore you to death with all those questions but like I said I'm new!

  10. #10
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,878
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    If you're using *n?x, it'd be
    Code:
    chmod go-x <directory>
    If you're using Windows, there's a long, complex and utterly painful method involving a hidden menu and a couple of buttons whose location I really can't remember now. And it won't work if you're using XP Home or anything before NT.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends franšais | entiendo espa˝ol | t˘i Ýt hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

Bookmarks

Posting Permissions

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