DOWNLOAD DEMO
Current Version: 2.4.1.0 2016-04-10
Need a hand? Join the community.

Hosting Multiple Sites Based on Host Names

Rate this Content 10 Votes

Configuring mojoPortal for Multiple Sites Based on Host Names/Subdomains

  1. Get mojoPortal CMS working properly on the first site (e.g. www.mysite.com).
  2. Setup IIS (or Apache) to handle requests for the other host name (e.g.: www.myothersite.com) or subdomain (e.g. othersite.mysite.com) you will be using for the second site. See Dedicated IP Address or IIS Host Headers for additional information.
  3. Configure your DNS server to point the host name of the second site to the same IP address as your first site.
  4. Make sure the web.config setting AllowMultipleSites is set to true (in the first site).
  5. Go to Administration > Site List and click the "Create New Site" link.
  6. Set the Site Title and then click the "Save" button at the bottom of the form.
  7. After you save the new site, some new tabs appear. Select the Host Name Mapping tab.
  8. Enter the host name for the new site and click the Add Host Name button.
  9. Open another browser window and navigate to the new site using the host name added in the previous step.

Dedicated IP Address or Host Headers?

Hosting multiple sites using host names requires you to have either Host Headers configured or a dedicated IP Address. Regardless of whether or not you are using a dedicated IP address or host headers, all host names that you wish to use with mojoPortal must be set in your DNS server to point to the IP address of the server running your mojoPortal installation. Most web hosts use Host Headers and provide a control panel of some sort to allow you to set them up. If you are running your own server and need help setting it up for either dedicated IP Addresses or Host Headers, please post in our forums or check out the IIS.net website. Information on hosting multiple sites with Apache Virtual Hosts and mod_mono is available in a tutorial here.

When using a dedicated IP address, your IIS site should be configured to handle all requests for that IP Address.

When using IIS Host Headers, your IIS site should be configured to handle requests for each host name you want to use with mojoPortal.

Note: Host Headers are called Bindings in IIS 7+.

Considerations for Multiple Physical Web Sites (Multiple Installations of mojoPortal)

If using multiple mojoPortal CMS installations with a single mojoPortal database, configure the second physical web site (installation) with the same database connection string as the first site. The host name you entered for the new site must point to the new site through DNS. mojoPortal uses the host name to determine the siteid from the database; if no host name is configured, the content will appear the same for both sites, since mojoPortal always defaults to the first site when requests arrive from an unconfigured host name.

The first site is the master site as it can control what features are installed in the child sites. If using multiple physical web installations and one database, it is probably best if only the first site has the web.config setting "AllowMultipleSites" set to true.

Testing Multiple Sites on a Development Machine

If you want to test host name based multiple sites on your development machine:

  1. Get the first site running at http://localhost
  2. Make sure this key is set to false in Web.config: <add key="UseFoldersInsteadOfHostnamesForMultipleSites" value="false" />
  3. You can simulate other host names by putting them in your c:\Windows\system32\drivers\etc\hosts file, its just a text file open it with notepad (On Windows Vista and above, you will need to run notepad as Administrator in order to edit this file--find Notepad under programs, then right-click and choose "Run as Administrator"). You will see an existing entry like this:
        127.0.0.1     localhost
  4. You can add as many additional host names as you like:
        127.0.0.1  someotherhost1
        127.0.0.1 www.myfakesite.com

Modified

  • 2011-09-04 Joe Davis of i7MEDIA
  • 2010-12-07 Jamie Eubanks