1000 FAQs, 500 tutorials and explanatory videos. Here, there are only solutions!
Redirect visitor (domain, web page, etc.)
This guide explains how redirect one domain name directly to another or how to automatically send visitors from your website to another page address (internal or external URL).
Preamble
- To redirect traffic, you'll have to act...
- ... or on Domain Names it itself (it must be hosted by Infomaniak and its DNS must be those of Infomaniak also),
- ... or on the code in your pages (page .htaccess, home page, etc.) if you have a website.
⚠For additional assistance contact a partner or launch a call for tenders free of charge — discover also the role of the host.
Acting on the domain name
via Web Forwarding Tool
L'tool available on the Manager allows simple action on the domain name (or subdomain) to redirect it to the Internet address of your choice.
via DNS modifications or record A
Change DNS of the domain name or modify its A/AAAA records allows you to direct web traffic to another provider.
Act on the code of the pages...
... via HTML code to be inserted
Insert this line of code between tags <head>
and </head>
of your home page (in principle named index.html):
<meta http-equiv="refresh" content="5;url=INSERT-HERE-NEW-URL">
Replace 5
by the desired second waiting time (0 for this to be done immediately).
The Google search engine indicates that it is preferable to use a 301-side server-side redirection (see below). The W3C also recommends not to use.
... via PHP code to be inserted
If the site page has a .php extension, insert this header function call at the top of the file:
header("refresh: 5; url=INSERT-HERE-NEW-PAGE-URL");
... via .htaccess file
To redirect absolutely all traffic targeting your site (regardless of which page is called) to another address, insert this in the file .htacces
at the root of your site:
RewriteEngine On
RewriteRule ^(.*)$ INSERT-HERE-NEW-URL/$1 [R=301]
To target the page that needs to be redirected:
Redirect permanent /ancienne_page.html insérer ici adresse URL de destination
Redirectpermanent
, Redirect permanent
and Redirect 301
are equivalent commands.
Here is another example of redirecting a subpart to the home page (this directive to the advantage of working with the "deep link" as opposed to a permanent redirection):
RewriteEngine on
RewriteRule "old/path/url "/" [L]
Be aware of this other guide on this subject.