Domains and DNS
Load another website in an 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:
- Add the domain in cPanel with its own directory
- 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
- Choose the www or non-www version and redirect the other Set up a 301 redirect between the www and non-www versions, keep paths with a wildcard and order the...
- Create and test a redirect in cPanel Explains the cPanel options for choosing 301 or 302, applying the change with or without www and kee...
- Redirect a domain without ordering hosting Shows how to send a domain without hosting, a specific path or all its URLs to another destination f...
- Redirect secondary domains to a main domain Explains how to point several secondary names to the main one using DNS and redirects in the current...
Something wrong or out of date? Tell us and we will review it.