I enabled the hotlink protection link at cPanel, and added four URLs to allow access:
https://myown.com.br
https://myclientssite.com.br
http://localhost
http://localhost:1984
And I added the extensions to block direct access:
bmp,css,eot,gif,ico,jpeg,jpg,js,png,otf,ttf,webp,woff
And I enabled to allow direct requests.
The Apache configuration code, that is located at the folder public_html, looks like:
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]
But these sites are still denied from loading these files. Until my own site also is bizarrely blocked. The same error 403 – Denied access.
Yes, I also added:
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>
Only my own site is unblocked, but myownclient.com.br, localhost and localhost:1984 are still blocked.
Update
Only the first two CSS files are blocked from opening, but all other CSS files are still unblocked from opening. All the JavaScript files also are still unblocked from opening.
I want to block all CSS and JavaScript files from opening.