Open a file w/ htaccess (or advanced hotlinking protection)

Posted on 2006-04-17
Medium Priority
Last Modified: 2010-03-04
Basically what I'm trying to do is prevent hotlinking in a fast, but effective, way. My plan was to require certain hotlinkable files to supply a hash when accessed like...
The hash changes, so old hashes eventually stop working.The catch is, I can only use htaccess files, so I can't use RewriteMap, which would make this fairly easy.

I'd make a proxy-like php script, but that's too big of a performance hit. So I'm looking for a way to access the file with the latest hash, or just a script, and check them against an argument ("hash") in the query. Seems simple enough, but I can't find anything.

The server is Apache 1.3, and I don't have access to http.conf, unfortunately.
Question by:Staticreator
  • 2
  • 2
LVL 27

Expert Comment

ID: 16485110
It's impossible to control characters behind '?' without using rewrite rules or LocationMatch or some wrapper script.
rewrite rules and location are not permitted in .htaccess, so wrapper is the only solution. What is a problem with PHP script performance?


Author Comment

ID: 16487732
...what? Rewrite rules (mod_rewrite) are allowed in .htaccess files, my problem is that I can't check any rewrite rules against a hash.

From what I've read, the performance of any PHP wrapper would be much slower. As always, Apache handles sending static files much better than anything I could ever write, and I'd prefer to keep it that way.
LVL 27

Accepted Solution

Nopius earned 600 total points
ID: 16493728
If you have control over .htaccess, can write php script that will modify your .htaccess

Author Comment

ID: 16495737
Seems so obvious now. Thanks!

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hi, in this article I'm going to teach you how to run your own site, and how to let people in (without IP). I'll talk about and explain each step... :) By the way, everything in this Tutorial is completely free and legal. This article is for …
If you are a web developer, you would be aware of the <iframe> tag in HTML. The <iframe> stands for inline frame and is used to embed another document within the current HTML document. The embedded document could be even another website.
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses
Course of the Month16 days, 23 hours left to enroll

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question