1

I am working on a client's site that used to have all .swf files in directories via product code eg. g18/g18_flashfile.swf but now i've moved them into assets/flash/g18_flashfile.swf

I have tried to mod_rewrite the request to the new location due to external sites hotlinking to the file. This just error 500s

RewriteRule ^([^/]+)/([^.]+)\.swf$ assets/flash/$1/$2\.swf [L]

I also cannot just do a redirect anything as I am already using the following

RewriteRule ^(.*)/$ product.php?ref=$1 [L]

Any help would be great as I am scratching my head on this one.

EDIT

Whats even stranger is when I do

RewriteRule ^([^/]+)/([^.]+)\.swf$ assets/flash/$1/$2\.html [L]

It works (obviously it 404s because there isn't a .html file) but the rewrite works. Does anyone know if swf are some kind of term used in mod_rewrite?

benpalmer
  • 2,057
  • 3
  • 17
  • 21

1 Answers1

1

The regular expression

^([^/]+)/([^.]+)\.swf$

matches both g18/g18_flashfile.swf and assets/flash/g18_flashfile.swf. Since the L flag might not work as you expected, this is a problem.

Just change the regular expression so that it doesn't match your rewritten path:

RewriteRule ^([^/]+)/([^/.]+)\.swf$ assets/flash/$1/$2\.swf [L]
Community
  • 1
  • 1
Tim Stone
  • 19,119
  • 6
  • 56
  • 66