Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1004
  • Last Modified:

htaccess RewriteRule interfers with Flash Media

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
edjent
Asked:
edjent
2 Solutions
 
fcontrepoisCommented:
Use RewriteCond


Options +FollowSymLinks
RewriteEngine On
RewriteCond %{REQUEST_URI} !.*\.(mov|mp4|flv)
RewriteRule ^Files/(.*)$ get.php?file=$1
0
 
Steve BinkCommented:
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
 
edjentAuthor Commented:
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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now