简体   繁体   中英

How can I redirect any direct requests for swf file to a wrapper page for that swf object

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM