[Solved] htaccess RewriteRule

#1
I am trying a redirection which is not working.

RewriteRule ^iembed\.swf\?key=(.*) http://www.domain.com/nvlab/player/player.swf?config=http://www.domain.com/nvlab/econfig.php?key=$1 [R=301,L]

Any help will be appreciated.
 
#4
webizen, Any idea why would IE not respect the redirect. It's working fine in FF/Chrome. Ie is showing a black box instead of playing video.
 

NiteWave

Administrator
#8
how about modify rewrite rule slightly:
Code:
RewriteCond %{QUERY_STRING} key=(.*)                                                                                                
RewriteRule ^iembed\.swf http://www.domain.com/nvlab/player/player.swf?config=http://www.domain.com/nvlab/econfig.php&key=%1 [R=301,L]
 
#10
please try: replace "&key=%1" to "\%3Fkey=%1". i.e.
Code:
RewriteCond %{QUERY_STRING} key=(.*)                                                                                 
RewriteRule ^iembed\.swf http://www.domain.com/nvlab/player/player.swf?config=http://www.domain.com/nvlab/econfig.php\%3Fkey=%1 [R=301,L]
 

webizen

Well-Known Member
#12
Just put the issue summary here so everyone is clear:

Server side has following redirect setup
Code:
RewriteRule ^iembed\.swf\?key=(.*) http://www.domain.com/nvlab/player/player.swf?config=http://www.domain.com/nvlab/econfig.php?key=$1 [R=301,L]
When request to http://www.domain.com/iembed.swf?key=abcdef, it will be redirected to http://www.domain.com/nvlab/player/...//www.domain.com/nvlab/econfig.php?key=abcdef as defined. This works fine for the direct request in any browser and video is playing.

However, html code
Code:
<embed src="http://www.domain.com/iembed.swf?key=abcdef" ... />
does not work in IE (work in FF/Chrome/Safari) since IE does not pass query string on redirect in this situation (redirect a request to a swf to another file, and add new request parameters in the redirect, IE will not pass the new parameters to the final object. It will only pass the original query params). Hence video is not playing.

Clearly, this is not a LiteSpeed issue but IE.

To work around this IE issue, you can try:

1. Remove "config=http://www.domain.com/nvlab/econfig.php?" from the rewrite rule. i.e. stick with original query parameter. Of course, swf code may need to be adjusted.
Code:
RewriteRule ^iembed\.swf\?key=(.*) http://www.domain.com/nvlab/player/player.swf?key=$1 [R=301,L]
2. If possible, put the substitution URL directly in the html code
Code:
<embed src="http://www.domain.com/nvlab/player/player.swf?config=http://www.domain.com/nvlab/econfig.php?key=abcdef">
 
Last edited:
Top