Header set Access-Control-Allow-Origin: https://oe7drt.com
Header set Vary: Origin

# Hotlink images prevention

# sends a 403 Forbidden

# SetEnvIf Referer "oe7drt\.com" localreferer
# SetEnvIf Referer ^$ localreferer
# <FilesMatch "\.(jpg|png|gif)$">
#    Require env localreferer
# </FilesMatch>

# rewrite to the `hotlinked.png` image and show this to any
# hot-linking origin page
# https://techexpert.tips/apache/apache-prevent-image-hotlinking/

RewriteEngine On
RewriteCond %{REQUEST_URI} !hotlinked\.png$
RewriteCond "%{HTTP_REFERER}" "!^$"
RewriteCond "%{HTTP_REFERER}" "!www.google.com"
RewriteCond "%{HTTP_REFERER}" "!www.bing.com"
RewriteCond "%{HTTP_REFERER}" "!duckduckgo.com"
RewriteCond "%{HTTP_REFERER}" "!oe7drt.com" [NC]
RewriteCond "%{HTTP_REFERER}" "!oe7drt.net" [NC]
RewriteRule "\.(gif|jpe?g|png)$"    "https://oe7drt.com/hotlinked.png"   [R,L]

# Other rewrites

RewriteRule "index\.json$" "feed\.json"
RewriteRule "index\.xml$" "feed\.xml"

RewriteRule "/assets/files/VARA_components.zip" "/files/VARA_components.zip"
RewriteRule "/assets/files/pdh.dll.zip" "/files/pdh.dll.zip"

# fix some 404 on files
RewriteRule "/blog/2021-10-03-winlink-and-vara-on-linux/VARA_components.zip" "/files/VARA_components.zip"
RewriteRule "/blog/2021-10-03-winlink-and-vara-on-linux/pdh.dll.zip" "/files/pdh.dll.zip"