Steve_H
Member
Posted 7 years ago #
I have a new WP blog, with my uploaded images in the wp-content file. I tried to ban hotlinking, but the .htaccess file in the main directory is full of a lot of WP B.S., and when I try to ban hotlinking, it disappears, and only my main page displays.
I tried putting a separate htaccess in the wp-content folder, but when I did that, the whole site displayed as text.
What am I doing wrong?
Ahh all of your .htaccess stuff outside the section that is managed by WP.
You will see comments indicating that there are WP sections. Anything outside of those sections are not touched by WP.
Regards
Put it in one .htaccess file, but you have to put it before or after the
# BEGIN WordPress
or
# END WordPress
I use .htaccess for password purposes.
Paste the code you need, then press Return twice so as to leave a clear gap between your code and what WP wants to do. Works without problems for me.
Steve_H
Member
Posted 7 years ago #
Okay, thanks for the comments.
Couldn't figure out what the first one means.
Second one didn't work.
Third one didn't work.
Fourth one didn't work.
Still trying.
The main rule about banning hotlinking is to only ban hotlinking in special direcotries that aren't used for anything internally. For example, place all of the files that you don't want anyone hotlinking to into a /ban/ directory, and prevent hotlinking for that directory only.
And, after banning everyone else, always remember to make sure that your domain is allowed. Otherwise, you're locked out too.
This is what I have in my image directories. Just a .htaccess with these lines:
Options +FollowSymlinks
Options +SymlinksIfOwnerMatch
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://tamba2.org.uk/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://www.tamba2.org.uk/.*$ [NC]
ReWriteRule .*.(png|gif|jpg)$ - [N,F,L]
It seems to do the job :)
I got a similar .htaccess file as podz in my wp-content, images and wp-images folders
I also added a robots.txt file in the root folder to prevent spiders from going into the above image folders.
If spiders don't index images then chances of others finding them is more difficult.
Recently in Cpanel I ipblocked a lot of servers (mainly warez forums) which were hotlinking to my images.