wiki:faq/domain/canonical-web-address

Version 3 (modified by Dana, 7 years ago) (diff)

--

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} !^mayfirst\.org$ [NC]
RewriteCond %{HTTP_HOST} !^$
RewriteRule ^/(.*) http://mayfirst.org/$1 [L,R]

You can do the same by replacing mayfirst.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, not within it; otherwise, the rewrite rules won't work.