1000 FAQs, 500 tutorials and explanatory videos. Here, there are only solutions!
Force a domain name into the URL displayed by the web browser
This guide explains how to force the Web hosting name to be displayed in the browser address bar to one of the domain names installed in alias/synonym or how to display the main domain in the address bar instead of the alias.
Limit "duplicate content" or double content
Suppose you have the accommodation votre-domaine.com
at Infomaniak and as a synonym domain name you have installed www.domainesyno.xyz
.
By default, when you type one of the domain names (votre-domaine.com
or domainesyno.xyz
) in the address bar of your browser, it is the one you type that will appear in the address bar.
So you have the opportunity to force the display of an address other than the one that was typed. So if someone taps domainesyno.xyz
, so it's votre-domaine.com
which will automatically appear in the address bar.
A code is to be entered in a file called .htaccess
which must be at the root of your hosting (in the folder /web
of your FTP). If this file does not yet exist, you must create it on the server.
Then insert these instructions into the file:
RewriteEngine on
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule (.*) https://votre-domaine.com/$1 [R=301,L]
Adjust the above code according to these indications:
- Replace
votre-domaine.com
by your domain name with the appropriate extension (.com, .fr, .ch, etc.) that you would like to see displayed in the address bar of the visitor's browser. Addwww.
before votre-domaine.com If necessary. - Replace the second line of the above code with "
RewriteCond %{HTTPS} off
"if a loop error occurs, this means that HTTP/2 is active for this site
Also take note of the automatic redirections to httpS.