Frage

I've seen a lot of anti-hotlink strategies, but so far none where each file needs a unique redirect.

My employer's site has over 500 PDF files of original artwork for printable papercrafts which she offers for free, monetizing through ads.

What we're trying to prevent is others simply linking to our .pdf files and letting their users access our content without ever seeing our ads. The goal is to catch these external links and redirect them to our .html page which links to that file.

What makes this different from a lot of problems I've read is that while we want to get the user as close to the file they're seeking as possible, there is no calculable link between the file names of the .pdf requested, and the .html where they should land.

The best idea I've come up with so far, given my knowledge of .htaccess is to use the best mod_rewrite anti-hotlink strategy I can find to rename /PDF/file.pdf to something like /PDF/file.redirect, then write a separate redirect rule for each one, such as /PDF/fall-leaves.redirect to /seasons.html, and so-on.

Is there a better solution to this problem?

Thanks, John

War es hilfreich?

Lösung

You can use a RewriteMap instead of a bunch of rules. See the Apache documentation for more details on how that works, but it's basically a lookup table.

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top