Solved

htaccess RewriteRule interfers with Flash Media

Posted on 2011-03-17
3
991 Views
Last Modified: 2012-06-27
I have a simple htaccess Rewrite rule:

Options +FollowSymLinks
RewriteEngine On
RewriteRule ^Files/(.*)$ get.php?file=$1

Simple and works great, if it finds http://myco.com/Files/62/****.doc it redirects to file=/62/****.doc... PERFECT

my only problem is that when I embed a Flash player and actually look for the mov, mp4, flv... file inside of /Files/somedir/somemovie.mp4

the flash player gives me permission denied as the redirect hits to get.php, FAIL

I tried something like:

Options +FollowSymLinks
RewriteEngine On
RewriteRule \.(mov|mp4|flv)$ -
RewriteRule ^Files/(.*)$ get.php?file=$1

I just need to ignore one case... where file.php embeds FlowPlayer which calls Files/somedir/somemovie.mp4 any time this happens ignore the get.php RewriteRule
0
Comment
Question by:edjent
3 Comments
 
LVL 9

Accepted Solution

by:
fcontrepois earned 250 total points
ID: 35164031
Use RewriteCond


Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_URI} !.*\.(mov|mp4|flv)
RewriteRule ^Files/(.*)$ get.php?file=$1
0
 
LVL 50

Assisted Solution

by:Steve Bink
Steve Bink earned 250 total points
ID: 35170047
I'd prefer to modify your existing RewriteRule rather than use a RewriteCond, but that is just personal preference.  I have no idea if one method is more efficient than the other.

RewriteRule \.(mov|mp4|flv)$ - [L]

Open in new window

0
 
LVL 1

Author Comment

by:edjent
ID: 35183609
Thanks guys both solutions work great, so I split the points..

I didn't end up using either actually. after slipping these in realized there is a case where I need to fwd MP4's there as well, SO in light... I push the dir back on the .htaccess since Fetch doesn't exist and never will at that level in the path, it makes sense and also frees my Flash player for loading! Simple and sweet, not sure why I overcomplicated that one.

Options +FollowSymLinks
RewriteEngine On
RewriteRule ^Files/Fetch/(.*)$ get.php?file=$1
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

Introduction As you’re probably aware the HTTP protocol offers basic / weak authentication, which in combination with the relevant configuration on your web server, provides the ability to password protect all or part of your host.  If you were not…
Over the last year I have answered a couple of basic URL rewriting questions several times so I thought I might as well have a stab at: explaining the basics, providing a few useful links and consolidating some of the most common queries into a sing…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

707 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now