Domain redirect (or forwarding) is the process of making a website accessible from multiple URLs. When someone enters a redirected URL in their browser, it takes them to a website with a different URL. This can be useful for shortening URLs, moving a website to a new address, or preventing common typos.
You can use domain redirect to ensure that users who make typing mistakes still reach your website by registering multiple domains with the most common typos. For example, Facebook redirects fcaebook.com to facebook.com, ensuring no traffic is lost. This also protects against competitors or phishing sites that use similar URLs to deceive users. For instance, domains like faecbook.com or afcebook.com may redirect to deceptive phishing sites.
If you manage multiple domains with different TLDs (e.g., .com, .net, .org), you can use domain redirect to point them to the same website, as Wikipedia does with wikipedia.com, wikipedia.net, and wikipedia.org.
If you’re moving your website to a new domain, you can set up a redirect on the old address to guide visitors to your new site. This way, search engines can update their records, just like your users.
Learn More About Domain Redirects
There are several methods to set up a domain redirect. Replace the www.example.uk with your desired domain.
- The simplest way to redirect visitors is through HTML. This method requires the visitor to click on a link:
Click <a href=http://www.example.uk/>here</a> to be redirected.
- Redirection via HTTP uses status codes that begin with the number 3
- 300: Multiple choices (e.g. video format or language selection)
- 301: Moved permanently (for pages that have permanently changed their URL)
- 302: Found (used for temporary redirects)
- 303: See other (used to direct users to another page)
- 307: Temporary redirect (used when a resource has been temporarily moved)
- HTML codes should be placed in the HTTP header. To implement a 301 redirect in HTML, you can use this code:
<html>
<head>
<title>Moved Permanently</title>
</head>
<body>
<h1>Page Moved</h1>
<p>This page has been moved <a href=http://www.example.uk/>here</a>.</p>
</body>
</html>
- Some servers allow custom headers through scripts. In PHP, you can create a 301 redirect like this:
header(’HTTP/1.1 301 Moved Permanently’); header(’Location: http://www.example.uk'); exit();
- In Apache, you can redirect using the mod_alias module with the following directive:
Redirect permanent /oldexample.html http://www.example.uk/newexample.html Redirect 301 /oldexample.html http://www.example.uk/newexample.html For more flexibility, the mod_rewrite the module is recommended: RewriteEngine on RewriteCond %{HTTP_HOST} ^([^.:]+\.)*oldexample\.example\.uk(:[0-9]*)?$ [NC] RewriteRule ^(.*)$ http://newexample.uk/$1 [R=301,L]
- There is also an HTML code called Meta Refresh, which will automatically reload or redirect the page after a specified amount of time. If set to 0 seconds, the redirect will behave like a 301 redirect. Below is an example where the redirect occurs after 3 seconds:
<html>
<head>
<meta http-equiv="Refresh" content="3; url=http://www.example.uk" />
</head>
<body>
<p>Redirecting in 3 seconds. Click <a href="http://www.example.uk">here</a> if not redirected.</p>
</body>
</html>
- Another way to redirect is through JavaScript:
window.location = 'http://www.example.uk/'
- You can also display a page inside a new HTML frame:
<frameset rows="100%”> <frame src=http://www.example.uk/> <noframes> <body>Click <a href=http://www.example.uk/>here</a>.</body> </noframes> </frameset>