Skip to content
Advertisement

how to generic .htaccess to prevent hotlink

The following code works fine:

JavaScript

but I want to make a generic script serve me for several sites I manage, but fails try to get

JavaScript

Advertisement

Answer

You can’t use variables inside the regex. You can work around this by using a RegEx backreference like so:

JavaScript

(note the # is just used as a boundry. It could be any character that isn’t used in domain-names.)

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement