Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

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).

share|improve this question
add comment

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.

https://support.google.com/webmasters/answer/139394?hl=en

share|improve this answer
add comment

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.

PDF.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.

share|improve this answer
    
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 Feb 15 '13 at 19:34
add comment

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:

redirect
domain.com/pdf/filename 
to 
subdomain.domain.com/pdfhandler.php?parentdomain=1&filename=filename

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

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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