Domains and DNS

Load another website in an iframe

Reviewed on 3 min read redirecciones iframe

This method loads one website inside another, but it is not a redirect: the browser's address bar keeps the outer domain and the remote content is shown in an iframe.

It will only work if the destination website allows other domains to embed it. If it responds with X-Frame-Options or a CSP frame-ancestors policy that prevents it, the browser will block the content and this cannot be fixed from the example.com hosting.

To make a domain example.com load a domain example.net through an iframe:

  1. Add the domain in cPanel with its own directory
  2. In the path linked to this domain, upload a file named index.html containing the following code:
<!doctype html>
<html lang="es">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Mi proyecto</title>
  <style>
    html, body { margin: 0; height: 100%; }
    iframe { display: block; width: 100%; height: 100%; border: 0; }
  </style>
</head>
<body>
  <iframe src="https://example.net" title="Web de ejemplo"></iframe>
</body>
</html>

Replace https://example.net with the full URL you want to load and adapt the title to describe its content.

The iframe does not carry over the URL, does not turn the remote content into your own content, and has limitations for search ranking, accessibility, cookies and logging in. Use an HTTP redirect when the aim is to send the visitor to the other address.

Check whether it suits your project

Test the content on mobile, keyboard navigation, links and logging in. An HTTPS page must not embed an HTTP version: it may be blocked as mixed content. Authentication or payment providers may also refuse to work inside a frame.

If the destination does not allow embedding, use a visible link or an HTTP redirect. Do not try to strip its protections through a proxy to make it look like your own content. Before replacing an existing index.html, save a copy so you can recover the previous home page.

You may also find useful

Something wrong or out of date? Tell us and we will review it.