Flash movies are called based on dynamic links on mypage.php. mypage.php has the flash player embedded. The links look like mypage.php?moviefolder=folder1/folder2&swfTitle=sometitle.swf. mypage.php is parsed on each link click (per the href). Folder2 is always the same but movieTitle.swf is dynamic. Sometimes subfolders will be called (folder2/subfolder2/sometitle.swf).
Can mod_rewrite allow the query string to reflect folder2 but instead silently serve folder3 as well as occasional subfolders? I would place all files in folder3. The goal is to have the user not know where the swfs are. Thanks in advance again!
Using a
RewriteCondto match the contents of the query string (since they are not read in aRewriteRuledirective, you can extractswfTitle=sometitle.swfand substitutefolder1/folder3forfolder1/folder2in themoviefolder.This will use a regex pattern like
([^&]+)to match everything up to the next&(which denotes another query param).Hopefully, you won’t get a rewrite loop, since the rewritten
folder1/folder3won’t match the second time.[NC]allows for a case-insensitive match.I did manage to successfully test this over at http://htaccess.madewithlove.be/, using the sample input: