我想取消阻止我的客户站点和我的生产站点从我自己的站点加载资产

I want to unblock my client's site and my production site from loading the assets from my own site

我在 cPanel 启用了热link保护link,并添加了四个 URL 以允许访问:

https://myown.com.br
https://myclientssite.com.br
http://localhost
http://localhost:1984

我添加了阻止直接访问的扩展:

bmp,css,eot,gif,ico,jpeg,jpg,js,png,otf,ttf,webp,woff

并且我启用了允许直接请求。

位于文件夹 public_html 的 Apache 配置代码如下所示:

RewriteEngine on

<IfModule mime_module>
  AddHandler application/x-httpd-ea-php74 .php .php7 .phtml
</IfModule>

RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://myclientssite.com.br/.*$                 [NC]
RewriteCond %{HTTP_REFERER} !^http://myclientssite.com.br$                    [NC]
RewriteCond %{HTTP_REFERER} !^http://myown.com.br/.*$                         [NC]
RewriteCond %{HTTP_REFERER} !^http://myown.com.br$                            [NC]
RewriteCond %{HTTP_REFERER} !^https://myclientssite.com.br/.*$                [NC]
RewriteCond %{HTTP_REFERER} !^https://myclientssite.com.br$                   [NC]
RewriteCond %{HTTP_REFERER} !^https://myown.com.br/.*$                        [NC]
RewriteCond %{HTTP_REFERER} !^https://myown.com.br$                           [NC]
RewriteCond %{HTTP_REFERER} !^http://localhost/.*$                            [NC]
RewriteCond %{HTTP_REFERER} !^http://localhost$                               [NC]
RewriteCond %{HTTP_REFERER} !^http://localhost:1984/.*$                       [NC]
RewriteCond %{HTTP_REFERER} !^http://localhost:1984$                          [NC]
RewriteRule .*\.(bmp|css|eot|gif|ico|jpeg|jpg|js|png|otf|ttf|webp|woff)$ -    [F,NC]

但是这些网站仍然被拒绝加载这些文件。直到我自己的网站也被奇怪地封锁了。同样的错误 403 – 拒绝访问。

是的,我还补充了:

AddType application/vnd.ms-fontobject    eot
AddType application/x-font-woff          woff
AddType font/eot                        .eot
AddType font/otf                        .otf
AddType font/opentype                    otf
AddType font/truetype                    ttf
AddType font/ttf                        .ttf
AddType font/woff                       .woff
AddType font/woff2                       woff2

AddType image/bmp                       .bmp
AddType image/gif                       .gif .GIF
AddType image/x-icon                    .ico
AddType image/jpeg                      .jpeg .jpg .JPEG .JPG
AddType image/png                       .png .PNG
AddType image/svg+xml                    svg
AddType image/svg+xml                    svgz
AddType image/tiff                      .tiff .tif

AddType application/json                 .json
AddType 'text/css; charset=UTF-8'        css
AddType 'text/js; charset=UTF-8'         js

<FilesMatch ".(bmp|css|eot|gif|ico|jpeg|jpg|js|png|otf|ttf|webp|woff)">
  Header set Access-Control-Allow-Origin "http://myown.com.br"
  Header set Access-Control-Allow-Origin "https://myown.com.br"
  Header set Access-Control-Allow-Origin "http://myclientssite.com.br"
  Header set Access-Control-Allow-Origin "https://myclientssite.com.br"
  Header set Access-Control-Allow-Origin "http://localhost"
  Header set Access-Control-Allow-Origin "https://localhost"
  Header set Access-Control-Allow-Origin "http://localhost:1984"
  Header set Access-Control-Allow-Origin "https://localhost:1984"
</FilesMatch>

只有我自己的网站解封了,但是 myownclient.com.brlocalhostlocalhost:1984 仍然被封。

更新

只有前两个 CSS 文件被阻止打开,但所有其他 CSS 文件仍未被阻止打开。所有 JavaScript 个文件也仍然无法打开。

我想阻止打开 所有 CSS 和 JavaScript 文件。

清除缓存。并尝试以下而不是:

RewriteEngine on

<IfModule mime_module>
  AddHandler application/x-httpd-ea-php74 .php .php7 .phtml
</IfModule>

#RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^https?:\/\/(((www\.)?(myclientssite|myown)\.com\.br)|localhost(:1984)?)(\/.*)?$
RewriteRule .*\.(bmp|css|eot|gif|ico|jpe?g|js|png|(o|t)tf|webp|woff)$ - [F,NC]

参见:https://regex101.com/r/P8Tsbh/1 and https://regex101.com/r/nXBWfT/1