Hotlink protection on WP 2.05
-
I was looking around and couldn’t find a clear hotlink protection tip on WP 2.05. I just want to tell you people about my experience.
A specific .htaccess file must be put in the wp-content/uploads directory, like this
RewriteEngine On
RewriteCond %{HTTP_REFERER} !^https://(.+\.)?yourdomain\.net/ [NC]
RewriteCond %{HTTP_REFERER} !^https://(.+\.)?subdomain. yourdomain \.net/ [NC]
RewriteCond %{HTTP_REFERER} !^https://(.+\.)? subdomain. yourdomain \.net/ [NC]
RewriteCond %{HTTP_REFERER} !^$
RewriteRule .*\.(jpe?g|gif)$ /angryman.png [L]
In case you use a sub domain, its URI should be stated.The last line defines a specific image (see mine) to be shown instead of the hot linked image. The (jpe?g|gif|bmp|js|mp3) are the file extensions to be access restricted, of course.
You may wish to show a 403 Forbidden page instead of an image; in this case, just replace the last line, as follows:
RewriteRule .*\.(jpe?g|gif)$ - [F]
- The topic ‘Hotlink protection on WP 2.05’ is closed to new replies.