1000 FAQs, 500 tutorials and explanatory videos. Here, there are only solutions!
Forcing a domain name in the URL displayed in the browser address bar
This guide explains how to force the display of the hosting name in the browser address bar to point to one of the alias domain names or how to display the main domain in the address bar instead of the alias.
Limiting "duplicate content"
Let's suppose that your-domain.com is hosted by us and you have installed www.aliasdomain.xyz as an alias domain name.
By default, when you type either of these domain names (your-domain.com or aliasdomain.xyz) into your browser address bar, the address that you type is the one that will appear in the address bar.
You thus have the option of forcing an address other than that typed in to be displayed.
Hence, if somebody types aliasdomain.xyz, your-domain.xyz is the address that will be automatically displayed in the address bar.
Some code must be placed in a file named .htaccess, which in turn must be located in the root of your hosting (in the /web folder of your FTP space).
If the file does not yet exist, you must create it on the server.
Then insert these commands into the file:
RewriteEngine on
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule (.*) https://your-domain.com/$1 [R=301,L]
Adapt the code above according to these indications:
- remplace your-domain.com by your domain name with the appropriate extension (.com, .fr, .ch, etc.) that you want to appear in your visitor's browser address bar. Add www. before your-domain.com if necessary.
- remplace the second line of code above by "RewriteCond %{HTTPS} off" if a loop error occurs; this means that HTTP/2 is active for this site
Also read about automatic redirecting to https: https://faq.infomaniak.com/1961