I have around 500 pages, some of which are simply PDF files, that are meant to be viewed within an iframe on a seperate domain parent page (files are subdomained, however reside on a different server).

What would be the best way to force the following behavior:

If a user visits any page within this subdomain, and that is not in the iframe of the main site, to either show a link to the main site, or force redirect to the main site (301?)

What would be the proper SEO way to make sure that the items hosted on the subdomain are properly referenced to the main domain?

As a side note, the subdomain can use any PHP necessary, however the main domain cannot use PHP (which is why the whole subdomain route is necessary).

3 Answers 3


Canonical links would be the "proper" way, I would think. Google even supports an HTTP header for use on PDFs and similar.



For ranking purposes you should move away from using an iframe and a sub domain all together. The method forward would be to embed your PDF files on directly onto the pages on the main domain using JS.


I recommend you take a look at pdf.js on github additionally you can view a online demo of pdf.js here. Looks superb and far cleaner than dirty 1990's iframes.

  • hmm, ill check into it - the iframes have caused various other problems, but generally are stuck where they are since the subdomain uses PHP to do alot of stuff with the files, and the main domain does not allow PHP.
    – NRGdallas
    Commented Feb 15, 2013 at 19:34

You could use .htaccess redirection to the subdomain pages. That redirects to your PHP enabled subdomain and add some variables in your pretty URL and handle using an iframe or not depending on where you come from in a PHP file. This will be the only way to have some decent SEO to these files.

Simple for example:


You can find a lot of examples on the use of .htaccess redirects on StackExchange Pro Webmasters.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.