[英]Allow access to the specific IP addresses which starts with specific series using .htaccess
I have my own shared server where my sites are hosted. 我有自己的共享服务器,用于托管我的网站。 Planning to consolidate/maintain all commonly used files like images, css, js etc., as different sub-domain.
计划将所有常用文件(如图像,css,js等)合并/维护为不同的子域。 For that domain, i want to deny the other users to access those files (preventing hotlinking).
对于该域,我想拒绝其他用户访问这些文件(防止热链接)。 All my website IP addresses are starting with 208. .
我所有的网站IP地址都以208开头。 .
。 ** series.
**系列。 How to achieve the result?
如何取得结果?
Here are my basic htaccess lines, 这是我的基本htaccess行,
RewriteEngine on
# Options +FollowSymlinks
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?mydomain.com/.*$ [NC]
RewriteRule \.(gif|jpg|jpeg|png|js|css)$ - [F]
Kindly share your ideas. 请分享您的想法。 TIA
TIA
You can add another condition: 您可以添加另一个条件:
RewriteEngine on
# Options +FollowSymlinks
RewriteCond %{REMOTE_ADDR} !^208\.
RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?mydomain.com/.*$ [NC]
RewriteRule \.(gif|jpg|jpeg|png|js|css)$ - [F]
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.