I have a webpage which has a topbar spanning across the top and then the content in a frame below. The content is on a different subdomain (i.e. the page is at sub.foo.com but the content frame at site.foo.com).

When people search for the site on Google the link is often to the content subdomain (i.e. site.foo.com) rather than sub.foo.com which has the topbar, which they should be taken to instead.

What are the best practices for handling this? We are implementing a redirect that will take the user to sub.foo.com if they go directly to site.foo.com, but I wanted to know if there were any SEO techniques we should be employing such as robots.txt or canonical site tags to prevent the content subdomain being indexed and linked to from search engines. Needless to say, we do not want to lose ranking due to any techniques we employ.

2 Answers 2


By using frames you're already hindering your SEO efforts as frames are not SEO friendly (and it's not great for usability or accessibility which is no coincidence).

Having said that your best bet is to check to see if the page is being loaded outside of a frame and then do a 301 redirect to the framed page. That will tell the search engines that the framed page is the correct page and to disregard the unframed version.

A better solution is to ditch the frames and use server side includes of some sort to handle the automatic inclusion of your topbar.

  • 1
    Totally agree. Unfortunately that part is beyond my control.
    – ICR
    Commented Oct 28, 2010 at 16:50
  • 1
    Note, you can't do a 301 Redirect in that situation, since you can't detect from the server if the page is in an iframe or not. Commented Oct 28, 2010 at 16:50
  • I was thinking about that. The best solution I have come up with so far is to always have the parent frame call the page with a querystring, like a timestamp, and if that timestamp is missing then throw the 301 header. If you wanted to refine it maybe have the page check to see if the timestamp is within 10 minutes of the current time. That way it keeps stale requests that may be saved, like in a search or a direct hyperlink, from working.
    – John Conde
    Commented Oct 28, 2010 at 17:15

As John said, frames are pretty bad for SEO. You are already doing a redirect which is OK from a user's point of view, but the search engines probably won't see that. My advice:

  1. Put a link on the inside page to the wrapper page, with target="_top" in case users click it. That should at least point a little "link juice" to the proper page.
  2. Add a canonical tag to the inside page too. This now works cross-domain so that might stem the problem.
  3. Find all links to the inside page and try to get them changed if possible.
  4. Add more links to the wrapper page from other places to try and get it ranking better.

It's a very difficult task, because the wrapper page doesn't contain any real content, only the inner page does. You are fighting a losing battle really, and ought to find a way around the frame option.

  • How would search engines respond to pages with quite different content pointing to a single url as the canonical url?
    – ICR
    Commented Oct 29, 2010 at 10:34
  • @ICR to be honest I don't know the answer to that one. It's probably worth trying it, I don't forsee any notable downside to it. Commented Oct 29, 2010 at 11:08

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.