1000 FAQs, 500 tutorials and explanatory videos. Here, there are only solutions!
Redirect a site's homepage (or any other web page) to another page or website
This guide explains how to redirect your visitors to another address once they have arrived on your website hosted by Infomaniak.
Paste this line of code between the <head> and </head> tags of your index page. Replace Time with the time in seconds or 0 so that redirection occurs immediately:
META http-EQUIV="Refresh" CONTENT="Temps; url=https://www.domain.xyz">
If your website page has a .php extension, insert this header call function at the very top of the file:
<?php header('Location: https://www.domain.xyz'); ?>
This setting will redirect absolutely all the traffic sent to your site (regardless of the page called) towards another address. Here are the rules to paste into the .htaccess file of your root directory:
RewriteRule ^(.*)$ https://www.domain.xyz/$1 [R=301]
A variation of the third option given above (redirection via .htaccess) enables you to target the page to be redirected. E.g.:
Redirect permanent /old_page.html https://new-page.xyzRedirectpermanent, Redirect permanent and Redirect 301 are equivalent commands.
Here is another example of redirecting a sub-section to the home page (this directive has the advantage of working with "deep links" as opposed to a permanent redirect):
RewriteRule "old/path/url "/" [L]