【发布时间】:2021-12-30 10:29:16
【问题描述】:
我正在尝试拒绝对我的网站的直接访问和跨域访问,因此我正在尝试使用通配符访问。
只有我的网站和受信任的域才能访问我的资产,如图像、java-script、css 文件等。
我正在尝试像这样 *.example.com 这样它将允许访问所有 https://www.example.com, http://www.example.com, http://example.com, https://example.com、https://subdomain.example.com 等
代码:
RewriteEngine on
RewriteCond %{HTTP_REFERER} !^ .*\.example\.com/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^ .*\.example\.com$ [NC]
RewriteRule .*\.(txt|ico|jpg|jpeg|gif|png|bmp|js|css)$ - [F,NC,L]
我的资产仍然没有阻止直接访问和跨域。
【问题讨论】:
标签: html apache .htaccess nginx http-status-code-403