如何将任何对swf文件的直接请求重定向到该swf对象的包装页面

So what I want to do is if you directly request mysite.com/object123.swf I want to redirect it to mysite.com/wrapper.php?name=object123 and have that swf object embedded in a the page. I am using php and apache. The problem I am having is that I end up with a redirect loop, where the embedded swf object is itself redirecting to mysite.com/wrapper.php?name=object123. So how do I get the swf object to display normally when I embed it on the wrapper.php page?

The question here is: what are you trying to achieve?

If you want direct links to have the SWF object in there, you will have to add a rewrite condition to see if the referrer is empty. Be warned, however, that this is not a trusted variable as browsers do not have to send it.

RewriteCond %{HTTP_REFERER} !^$ 

Is the condition you are after. This little piece, put before a RewriteRule, will only trigger the rewrite rule if the condition is met - here, that the referrer is empty. Direct links will therefore get the rewrite, whereas a plug-in load will have a referrer (the page URL it came from) and will therefore pass through.