I don't think there is any way to do that. You just don't have any real control over what the browser sends as a referer.
The main page will have a referer from the previous page, but anything that the main page refers to (iframes, images, etc) will receive a referer URL of the main page. It is, after all, the main page that is referring to the iframe/image/whatever, not the page you came from before.
You could have the main page be a .php that passes the original referer to the iframes via a parameter in the iframe's URL, but if the page in the iframe is checking HTTP_REFERER then that's not going to work. Also, it's not as trustworthy as a referer.
Of course, this is assuming you receive a referer at all. Some browsers and/or proxy servers are configured to not send referers.