Solved

htaccess RewriteRule interfers with Flash Media

Posted on 2011-03-17
3
1,000 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

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

If you've heard about htaccess and it sounds like it does what you want, but you're not sure how it works... well, you're in the right place. Read on. Some Basics #1. It's a file and its filename is .htaccess (yes, with a dot in the front). #…
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…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

733 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