Knowledge base

1000 FAQs, 500 tutorials and instructional videos. Here, there are only solutions!

Redirect the visitor (domain, web page, etc.)

Update 08/06/2026

This guide explains how to redirect a domain name directly to another, or how to automatically send visitors to your website to another page address (internal or external URL).

 

Introduction

  • To redirect traffic, you will need to take action…
    • … either on the domain name itself (it must be hosted by Infomaniak and its DNS must also be Infomaniak's),
    • … or on the code present in your pages (e.g., .htaccess page, homepage, etc.) if you have a website.

 

Acting on the domain name

Via Web Redirection Tool

The tool available in the Manager allows you to easily manage your domain name (or subdomain) and redirect it to the internet address of your choice.

via DNS modifications or A record updates

Change the DNS of the domain name or modify its A/AAAA records to redirect web traffic to another provider.

 

Modify the page code…

… by inserting HTML code

Insert this line of code between the <head> and </head> tags of your homepage (usually named index.html):

<meta http-equiv="refresh" content="5;url=INSERT-HERE-NEW-URL">

Replace 5 with the desired wait time in seconds (0 for immediate execution).

The Google search engine indicates that it is preferable to use a 301 redirect on the server-side (see below). The W3C also advises against using it.

… via PHP code to be inserted

If the website page has a .php extension, insert this function call at the very top of the file:

header("refresh: 5; url=INSERT-HERE-NEW-PAGE-URL");
```

… via the .htaccess file

… via fichier .htaccess

To redirect all traffic to your site (regardless of the page being accessed) to another address, insert the following into the .htaccess file at the root of your site:

RewriteEngine On
RewriteRule ^(.*)$ INSERT-HERE-NEW-URL/$1 [R=301]

To target the page that should be redirected:

Redirect permanent /old_page.html insert destination URL here

Redirectpermanent, Redirect permanent, and Redirect 301 are equivalent commands.

The following is another example of redirecting a sub-section to the homepage (this directive has the advantage of working with "deep links" unlike a permanent redirect):

RewriteEngine on
RewriteRule "old/path/url" "/" [L]

Refer to this other guide for more information.


Has this FAQ been helpful?