wiki:faq/domain/canonical-web-address

Version 8 (modified by Enrique Rosas, 9 years ago) ( diff )

--

TranslatedPages

I have multiple domain names that point to my web site - how to I make it so my preferred domain always appears in the browser address bar?

Many of us have multiple domain names that point to the same web site. For example, you can access our web site by going to mayfirst.org, or www.mayfirst.org, or www.people-link.net, etc.

However, we want people to always see mayfirst.org in the address bar of the browser.

We do that by adding the following lines to the Web Config settings in the Members Control Panel:

RewriteEngine On
RewriteCond %{HTTP_HOST} !^example\.org$ [NC]
RewriteCond %{HTTP_HOST} !^$
RewriteRule ^/(.*) http://example.org/$1 [L,R]

You can do the same by replacing example.org with the domain name you want your web site to display in the address bar of the browser. Be sure to place these lines outside of the <Directory> </Directory> section of your web configuration (if it existed), not within it; otherwise, the rewrite rules won't work.

What if I want to force visitor of my website to use HTTPS?

You can add the following lines to the Web Config settings in the Members Control Panel:

RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^/(.*) https://example.org/$1 [L,R]
Note: See TracWiki for help on using the wiki.