配置闪亮的服务器以指示一次

I would like to prevent users from accessing a shiny app using direct access:

http://www.mywebsite.com:3838/plot/2

I have modified the shiny configuration file so that anyone who accesses the app directly as stated above gets redirected.

location /plot/2 {
redirect "http://mywebsite.com/index.php?r=site/page&view=check2" 302 true;}

check2.php is used to ensure that the user attempting the direct access is a member. Check2 also has an iframe src the same as

http://www.mywebsite.com:3838/plot/2

This causes an infinite redirect loop as the configuration file redirects /plot/2. I would like the redirect directive to occur only if someone is trying to access via direct access. I would like the redirect not to apply to the iframe src that exists in check.php. I was wondering if there is any way to

1. Write a statement in php to disable redirect statement for the iframe OR
2. Write a statement in shiny config to apply redirect to certain sources of requests OR
3. Write a statement in htaccess to disable redirects on check.php

Thank you very much as all help is greatly appreciated.