: Reverse iframe breakout 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
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).
More posts by @LarsenBagley505
3 Comments
Sorted by latest first Latest Oldest Best
Canonical links would be the "proper" way, I would think. Google even supports an HTTP header for use on PDFs and similar.
support.google.com/webmasters/answer/139394?hl=en
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.
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.
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.