WordPress.org

Ready to get started?Download WordPress

Forums

permalinks and hotlink protection (16 posts)

  1. Erin23
    Member
    Posted 7 years ago #

    I've searched for topics on getting hotlink protection to work with permalinks. The ones I found didn't seem to have a solution. When I enable hotlink protection, my pages no longer work, they are name based.

    How would I get hotlink protection to work and have my pages function as well?

  2. Roy
    Member
    Posted 6 years ago #

    Is this discussion about the Hotlink Protection Plugin? I have tried to do the same with an htaccess file, but whatever I tried, my own website didn't show its own images. Then I ran into the plugin, but I can't get this thing to work at all. Now I do get my own images, but everyone else as well. The plugin automatically refers to the uploads folder, but I have my images in a separate folder being "www.example.com/database1/images" (database1 because I have five running). So I filled the options field of the plugin with simply "images", but also "/images", "/database1/images" and "http://www.example.com/database1/images", but nothing works. It's not a cache problem. I try the new settings with a newly started Browzar (which cleans everything up at closing) and use a different image every time, so that can't be it. Ideas anyone? Does anyone have experience with the plugin?

  3. Roy
    Member
    Posted 6 years ago #

    *bump*

    what's wrong with this htaccess file? just like the rest, it either results in a 500 error page if I put it in the 'wp root' or blocks my own site as well if I put it in the images folder.

    RewriteEngine on
    RewriteCond %{HTTP_REFERER} !^$
    RewriteCond %{HTTP_REFERER} !^http://www.gangleri\.nl/.*$ [NC]
    RewriteCond %{HTTP_REFERER} !^http://www.gangleri\.nl$ [NC]
    RewriteRule .*\.(jpg|jpeg|gif|png|bmp|swf)$ http://www.http://en.wikipedia.org/wiki/Hotlinking/ [R,NC]
  4. Roy
    Member
    Posted 6 years ago #

    Yes I keep talking to myself. It would be nice if someone talked back...

    I was wondering if my hosting provider actually uses an Apache webserver, since that's about the only server I can information about. I can't find it! On some forum someone mentioned a Linux webserver, but I don't know if that's just the software running or actually a different (kind of) server. Could it be and could this be something to explain my problem?

    Also I tried to find out if my provider perhaps doesn't allow htaccess files, but also here I can't find information. I do have webstats behind a login and I can make password protected folders, so I suppose I can use htaccess. So it must be the file.
    I have put WordPad (which I prefer over Notepad) to "no wrap", I upload as Ascii after which I change the filenam to .htaccess. One version of the file I have posted above. This is about all I (think I) can try, or...?

    Also (as mentioned) I have installed the hotlink protection plugin, but it doesn't do a thing. (I haven't tried if the plugin conflicts with the htaccess files, but before I found the plugin I couldn't get the htaccess files to do what I want already.)

  5. whooami
    Member
    Posted 6 years ago #

    Apache web server and Linux should not be confused. Linux is an Operating System. Apache is a web server. Apples and oranges. :)

    As for your hotlinking, try this:

    RewriteEngine On
    RewriteCond %{REQUEST_FILENAME} \.(gif|jpeg|jpg|png|swf)$ [NC]
    RewriteCond %{HTTP_REFERER} !^$ [NC]
    RewriteCond %{HTTP_REFERER} !gangleri\.nl [NC]
    RewriteRule (.*) http://www.http://en.wikipedia.org/wiki/Hotlinking

    that will work, and wont ban your domain, but bear you mind youre going to see image hits from sites that you WANT to be able to grab your images. feedburner is one such animal, bloglines might be another.

    there's also live, and google's feedreader.

    so you might want to include these under your domain above:

    RewriteCond %{HTTP_REFERER} !google\. [NC]
    RewriteCond %{HTTP_REFERER} !bloglines\. [NC]
    RewriteCond %{HTTP_REFERER} !feedburner\. [NC]
    RewriteCond %{HTTP_REFERER} !live\.com [NC]

    AND.. I really dont recommend putting that in your uppermost .htaccess. Its much wiser to put that in a sub directory that contains images.. or the upper most directory thats STILL a subdirectory.. if you follow.

  6. Roy
    Member
    Posted 6 years ago #

    Internal Server Error
    The server encountered an internal error or misconfiguration and was unable to complete your request.
    
    Please contact the server administrator to inform of the time the error occurred and of anything you might have done that may have caused the error.
    
    More information about this error may be available in the server error log.
    
    Web Server at mydomain.nl

    I uploaded the file in http://www.mydomain.nl/test (where the WP installation is), as Ascii and with rw-r-r as rights...

    If I put the file in mydomain.nl/test/wp-content, it seems to override my style.css (the information appears on the screen, but the layout is gone). If I put the file in mydomain.nl/test/wp-content/uploads it block my own site.

    But to come back to the webserver thing, is there something else than Apache and could this explain anything? Any ideas on why the plugin doesn't just work (that would be so much easier :-)

  7. whooami
    Member
    Posted 6 years ago #

    your host is running is CentOS. Your web server is Apache.

    And there is absolutely NOTHING wrong with the code I pasted for you. I've tested EXACTLY that with no changes, and get no errors.

    Not to mention that its a variation of what I use on my own site, and have used for 3 plus years without issue. I dont block my own domain.

    Are you sure your host supports mod_rewrite? I notice you are NOT using pretty permalinks.

  8. Roy
    Member
    Posted 6 years ago #

    your host is running is CentOS. Your web server is Apache

    Ah, how did you find that out so quickly if I might ask?

    Are you sure your host supports mod_rewrite?

    Eh? I can change the settings for owner, group and others for the options read, write and execute/search if that's what you mean.

    I notice you are NOT using pretty permalinks.

    I know. I used to have a simple html based website and when I was building a WP site and put about 1.000 posts in the databases and websites and search engines started to refer to the new site, I tried to change the permalinks, but when it didn't immediately work, I thought it would be better to just leave it like it is. I just tried it in the my test surroundings, I can make pretty permalinks. Does that mean something for you...?

  9. whooami
    Member
    Posted 6 years ago #

    Ah, how did you find that out so quickly if I might ask?

    magic :)

    Eh? I can change the settings for owner, group and others for the options read, write and execute/search if that's what you mean.

    Nope, that doestn have anything to do with mod_rewrite. Thats just being able to assign permissions.


    I notice you are NOT using pretty permalinks.

    See above, typically, people that run into issues with pretty permalinks do so because their host doesnt support mod_rewrite.

  10. Chris_K
    Member
    Posted 6 years ago #

    (side note and perhaps irrelevant: The last flavor of CentOS I configured had mod_rewrite disabled by default)

  11. Roy
    Member
    Posted 6 years ago #

    Okay, okay, I'm going to ask the stupid question: what is mod_rewrite then and how do I check if I'm allowed to (does the fact that I can make pretty permalinks already answer the question?). And if I can 'mod_rewrite' where does WP put the change of urls? htaccess? Maybe I'd try to find that little fellow then and try my trick on him.

    Extra question, but the initial question in this threat was about permalinks, so it's not completely off-topic: with a website up and running for over half a year, indexed by search engines and referred to by other websites, is it smart to still think about pretty permalinks? Won't all existing refferences be broken? And more, I have very long post titles (i.e. "book title * full author name (publisher, year, isbn)") I might better limit the pretty permalinks to five or so words, or...?

  12. Roy
    Member
    Posted 6 years ago #

    You're not going to believe this. I accidentally found out that when I change something in the permalinks (another option and back to default is enough) and suddenly the plugin works! It is as if WP first 'didn't know' that there was an htaccess file...

    So now only my permalink question remains.

  13. Chris_K
    Member
    Posted 6 years ago #

    with a website up and running for over half a year, indexed by search engines and referred to by other websites, is it smart to still think about pretty permalinks?

    If the Permalinks have been the default style, they'll always work regardless of how "pretty" you make them.
    So, you can always change from Default to pretty with minimal (none?) impact.

    However, if you're going from format of pretty to another, then you have some challenges ahead...

  14. Roy
    Member
    Posted 6 years ago #

    He, you're right. I thought I tested that yesterday and 'ugly requests' were referred back to the index page, but apparently that isn't the case.
    But what about shortening the name-based permalink, is that possible or doesn't it matter when an url becomes as long as http://www.mywebsite.nl/bookreviews/the-destiny-of-the-warrior-georges-dumezil-1970-university-of-chicago-isbn-0226169685/
    (btw, I change my url in posts because Google gives this forum is little bit too much credit :-) )

  15. Chris_K
    Member
    Posted 6 years ago #

    Well, how would you shorten it? That last part is the post slug, right? To shorten that, you'd have to edit the post (slug is in the right column on the Post editor). If you rename the slug, then the old links would be broke.

    (and honestly, I dunno enough about SEO to even theorize if URL length matters)

  16. Roy
    Member
    Posted 6 years ago #

    I just gave it a try and see what happens. Thanks.

Topic Closed

This topic has been closed to new replies.

About this Topic