Forum Moderators: phranque

Message Too Old, No Replies

Mod rewrite weird malfunction in calling sfw file

External redirect directive works while the same internal one fails

         

catalin

10:19 pm on Dec 21, 2009 (gmt 0)

10+ Year Member



Hello,

the following directive (external redirect) works just fine for me:

RewriteRule ^/v/([0-9]+)$ /MediaPlayer.swf?MediaID=$1&Embed=true [L,R=301]

while transforming the same exact rule into an internal one makes the swf file not load properly:

RewriteRule ^/v/([0-9]+)$ /MediaPlayer.swf?MediaID=$1&Embed=true [L]

The swf gets accessed in both cases, but in the second one it doesn't work the way it's supposed to, it seems it's not able to load its dependencies (assets.swf ..). Any idea what is causing this and how to solve this problem ?

thank you,
Catalin

jdMorgan

11:28 pm on Dec 21, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It's likely that the player or the script that instantiates it (e.g. SWFObject or similar) is using page-relative links to resolve the location of the .flv and other files. Since you've rewritten the URL, the 'page URL' (/v/123) is now different from the filepath (/MediaPlayer.swf) and so this URL-to-filepath resolution won't work -- The script will think all the files are in a physical subdirectory named "/v/".

So a solution might be to modify the scripts to use the correct directory location as the base filesystem (directory) path to find the included objects.

Before rushing off to do that though, take a look at the client/server transactions using the "Live HTTP Headers" add-on for Firefox/Mozilla (or similar) -- It may be that all you'll need to do is put a few more rewrites in place to re-map the other URL requests for related objects to the proper filepath as well -- e.g. rewrite URL request http://example.com/v/assets.swf --> filepath /assets.swf.

Jim

catalin

7:27 am on Dec 22, 2009 (gmt 0)

10+ Year Member



File paths don't seem to be the issue, first even if I modify the rule to (no directory paths):

RewriteRule ^([0-9]+)$ /MediaPlayer.swf?MediaID=$1&Embed=true [L]

it still doesn't work. Also all files are grabbed from another domain all together.

Checking out with Live HTTP the differences between the files that the 2 instances request ( domain.com/MediaPlayer.swf?MediaID=$1&Embed=true vs domain.com/123 ) I have noticed the second doesn't request all the files it's supposed to

Any idea what can cause this ?

Thanks

jdMorgan

10:05 pm on Dec 22, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Anything in your server error logs (on either server)?

Do be sure to completely flush (delete) your browser cache between tests, so that browser caching doesn't interfere with your test results.

In all cases -- while checking URLs with the headers checker and when looking at filepaths in your server error log(s), pay close attention to the paths and be sure they are correct.

If you have any client-side code (e.g. JavaScript), make sure it's not using the .swf file's URL to 'build' the URLs for the other objects that need to be requested, since that .swf URL has now been changed and gets rewritten. Any URLs based on this changed URL will also need to be rewritten -- (whether you add directory paths like "/v/", or not).

Jim