Forcing a Preferred Host Name

In some cases you may have a site that will work with more than one host name, but for better tracking in google analytics and for better SEO (search engine optimization), you should force it to use a particular host name no matter which host name the request comes in as. So for example on this site one could use or but for consistent tracking we want to force it to use Another reason we want to force it to is because our SSL certificate is for and people would get browser warnings about the certificate not matching if they tried to login to

To enable forcing a preferred host name in mojoPortal content management system, you need to set this as true in your Web.config or user.config file:

<add key="AllowForcingPreferredHostName" value="true" />

Then it will be available in Site Settings:

Preferred Host Name Setting screen shot

In a multi site installation it can only be set from the root admin site, but you can set it there for any site. Be very careful with this setting, the reason its disabled by default is because it will force a redirect to the entered host name and if you put in an incorrect host name you may not be able to access your site without fixing it in the database.

If you are in a situation where you need to alter this setting via the database, the value is stored in mp_sites.apikeyextra5.

So for example you could clear it out by using

UPDATE mp_Sites
SET ApiKeyExtra5 = ''
WHERE SiteID = [yoursiteid]

You could leave out the WHERE clause if you want to remove it from all sites, or if it is a single site installation.