Seeing the URL rejected by mod_rewrite

Posted on 2011-10-08
Medium Priority
Last Modified: 2012-05-12
I'm trying to use mod_rewrite statements in .htaccess to block access to a directory of mp3 files.  But the Rewrite_cond statement I have is also blocking the accesses made by an embedded QuickTime player I have  on a page in the directory.  It would be easier to craft a Rewrite_cond statement that would let the player requests through and block browser accesses if I knew what the request from the player  looked like  at the server.  When you put a URL in a browser to access the files the mod_rewrite failure gives you back an error that shows the failing URL,  but when the player makes the access it gets back the failure and then just refuses to come up, without saying anything.  Is there any way I can get Apache to show me the URL from the player that it's rejecting?

Thanks for any ideas.
Question by:steva
LVL 51

Accepted Solution

Steve Bink earned 2000 total points
ID: 36937789
You have a few options:

1) The Apache log.  All requests will go here originally, in their unmodified form.  
2) The rewrite log.  If you light it up, it will show you the original URL, how it is parsed by the various rules, and the final outcome.  Note that this can balloon in size really quickly.
3) Use a server-side dump page to catch the rejected URL and log it with your own custom application.  It doesn't have to be anything fancy...just a small DB that records origination, URL, etc.

Author Comment

ID: 36937886
Many thanks!

Featured Post

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

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

In my time as an SEO for the last 2 years and in the questions I have assisted with on here I have always seen the need to redirect from non-www urls to their www versions. For instance redirecting http://domain.com (http://domain.com) to http…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
Loops Section Overview
Suggested Courses
Course of the Month13 days, 8 hours left to enroll

749 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