Changes between Version 9 and Version 10 of faq/domain/canonical-web-address
- Timestamp:
- Apr 10, 2019, 3:12:14 PM (5 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
faq/domain/canonical-web-address
v9 v10 4 4 = 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? = 5 5 6 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.6 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 `example.org`, or `www.example.org`, or `www.example.net`, etc. 7 7 8 However, we want people to always see ` mayfirst.org` in the address bar of the browser.8 However, we want people to always see `example.org` in the address bar of the browser. 9 9 10 We do that by adding the following lines to the Web Config settings in the [https://members.mayfirst.org/cp Members Control Panel]:10 We do that by adding the following lines to the Web Config Settings in the [https://members.mayfirst.org/cp Members Control Panel] (click the Show Advanced Settings button to access the Settings field): 11 11 12 12 {{{ 13 RewriteEngine On14 RewriteCond %{HTTP_HOST} !^example\.org$ [NC]15 RewriteCond %{HTTP_HOST} !^$16 RewriteRule ^/(.*) http://example.org/$1 [L,R]17 }}}18 19 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.20 21 The [https://httpd.apache.org/docs/2.4/rewrite/avoid.html Apache docs] suggest the above should now be done using an If statement and Redirect rule as written below.22 {{{23 13 <If "req('Host') != 'example.org'"> 24 Redirect "/" "http ://example.org/"14 Redirect "/" "https://example.org/" 25 15 </If> 26 16 }}} 27 17 18 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. In this example, we are redirecting to an https site - be sure to enable https in the control panel if you are redirecting to an https site. Otherwise, redirect to http://example.org instead. 28 19 29 20 == What if I want to force visitor of my website to use HTTPS?== 30 21 31 You can add the following lines to the Web Config settings in the [https://members.mayfirst.org/cp Members Control Panel]: 32 33 {{{ 34 RewriteEngine On 35 RewriteCond %{HTTPS} !=on 36 RewriteRule ^/(.*) https://example.org/$1 [L,R] 37 }}} 38 39 The [https://httpd.apache.org/docs/2.4/rewrite/avoid.html Apache docs] suggest the above should now be done using a simpler Redirect rule as written below. 40 {{{ 41 Redirect "/" "https://www.example.org/" 42 }}} 22 In the Advanced section of the web congiration in the [https://members.mayfirst.org/cp members control panel], there is a checkbox called "Redirect http" - ensure it is configured to redirect http traffic to https. You must enable https for this redirect to work.