• Introducing WebPros Cloud - a fully managed infrastructure platform purpose-built to simplify the deployment of WebPros products !  WebPros Cloud enables you to easily deliver WebPros solutions — without the complexity of managing the infrastructure.
    Join the pilot program today!
  • Support for BIND DNS has been removed from Plesk for Windows due to security and maintenance risks.
    If a Plesk for Windows server is still using BIND, the upgrade to Plesk Obsidian 18.0.70 will be unavailable until the administrator switches the DNS server to Microsoft DNS.

Issue htaccess hotlink protection issue with ip6

WiseWill

New Pleskian
Server operating system version
Ubuntu 24.04
Plesk version and microupdate number
18.0.68 Update #2
I have it where you go to the ip4 address and all images show in the browser. I was able to accomplish this by adding RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?217.160.146.1(/)? [NC] to the htacces file. I tried to add RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?2607:b500:400::01(/)? [NC] and the images won't show in the browser. I tried adding the /64 and /80 CIDR. I tried to add short and long addresses of the ip address.

I have an example of what I am trying to use.

RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?domainname.org/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?domainname.org$ [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?217.160.146.1(/)? [NC]
RewriteCond %{HTTP_REFERER} !^http(s)?://(www\.)?2607:b500:400::01(/)? [NC]
RewriteRule .*\.(jpg|jpeg|gif|ico|png|bmp)$ - [F,NC]

I have read this should work. There is something I am missing, and I am just too close to it to see the forest through the trees. How should I be writing the file for ip6? I have tried to find a resource only through searches and there are not any that I could find. Thank you for your assistance.
 
As far as I'm aware, to utilize IPv6 directly in a browser you would need to put the IPv6 address in brackets ([IPv6:Add:res:s]). Don't know how it'll work in .htaccess in terms of how to add it but that should give you some clue.
 
Putting the IPv6 in square brackets would be correct, see this: https://www.ietf.org/rfc/rfc2732.txt

But how do you access your site via IPv6 for testing purposes currently if you don't know how to? I mean that this is a .htaccess independent problem/question in the first place.

And an IP can't have a subdomain like "www", so you can leave it out.

Please be aware that you have to escape the brackets as they are part of regular expressions. You should also escape dots, although this makes no difference in your example.
 
Back
Top