Hai,

I developed a website and I using iframe to add a page ( called inner.php) in the main page (index.php) . Everything working fine. But now the problem is when we searched the site in google then 2 results will came. First one leads to my home page ie "index.php". But the second will leads to the other page "inner.php" . The inner.php is only the part of index.php So that when a user follow that link only that part will show in the browser. Please let me know is there is any way to prevent the second result from google search with out any harm to my website.


Thanks
Rajeesh

Dani AI

Generated

As hinted, the framed file is a separate URL. Because inner.php is reachable on its own, Google can crawl and index it — which is why you see two results instead of just index.php.

Two practical fixes:

  • Do the embed server-side so there is no standalone inner.php to index. Move the fragment out of public URLs (for example into an include directory outside the web root) and serve it from index.php with a server-side include. This removes the separate URL entirely; see the PHP include manual for details: PHP include.

  • If changing architecture is not possible, tell search engines to drop inner.php. Add a robots meta noindex tag to inner.php and make sure that page is not blocked by robots.txt (Google must be able to fetch it to see the noindex). A rel="canonical" from inner.php to index.php can help too, but canonical is only a hint and not guaranteed. See Google’s guidance on noindex and canonical signals: Block indexing with a robots meta tag and Consolidate duplicate URLs (canonical).

Quick notes and cautions:

  • Do NOT disallow inner.php in robots.txt while expecting a meta noindex to work — if Google can’t crawl the page, it can’t see the noindex and may still list the URL.
  • After adding a noindex, use Search Console’s URL tools (URL Inspection / Removals) to speed up re-crawling and removal.
  • If many external sites link directly to inner.php, it may take longer to disappear; restructuring to avoid a public inner.php URL is the cleanest, long-term fix.

For , moving to server-side includes is the most reliable and SEO-safe path.

Recommended Answers

All 2 Replies

Iframes really aren't recommended. Is there a reason that you need to be using them?

Well thanks for your reply,

I used Iframe because with iframe I can exactly fit a web page in a cell of another page. Please let me know is there is any other method to do that other than the iframe

Thanks
Rajeesh

Iframes really aren't recommended. Is there a reason that you need to be using them?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.