install / siteaccess  

Using site access

What is site access?

Once you've gotten Exponential up and running on a server you need to configure the system. You can have several different sites running on the same Exponential installation. To distinguish between these sites you need to set up something called site access. The site access defines how Exponential will recognize which site you're accessing. Exponential will then know which database to use, which design to show etc.

Site access configuration

Host

In this example we will name our site 'www.mybookstore.com' and we will use 'admin.mybookstore.com' as the administration interface. To make Exponential fetch site access from host names you need to configure a DNS server and point the domains to your web server. When your DNS is up and running and the names resolve to your web server and your Exponential installation you need to make Exponential recognize the names and use the correct configuration. To do this you open the configuration file found in 'settings/site.ini' in the root of your Exponential installation. In site.ini browse down to the section [SiteAccessSettings] and alter the configuration as shown below. Only the settings you need to change are shown below.

file: settings/site.ini

[SiteAccessSettings]
MatchOrder=host
HostMatchRegexp=^(.+)\.mybookstore\.com$
HostMatchSubtextPost=\.mybookstore\.com

Here we told Exponential to take the part before .mybookstore.com of the url and map it to a directory in settings/siteaccess. If we enter 'www.mybookstore.com' in our browser Exponential will look a directory called 'www' in settings/siteacces. Now that Exponential knows how to distinguish between the two domains we need to create a configuration file for each site. This is done by creating two folders under 'settings/siteaccess/' which corresponds to our matches ( 'www' and 'admin' ). In both these folder you need to create a file called site.ini.append. This is the configuration file which will be used to override any of the standard settings in Exponential. We will keep our example simple and have just made a few settings to distinguish between the two sites. You can see the two configuration files below.

file: settings/siteaccess/admin/site.ini.append

[SiteSettings]
LoginPage=custom

[SiteAccessSettings]
RequireUserLogin=true

The configuration LoginPage=custom means that Exponential will use a separate template for the login page of the administration site. RequireUserLogin=true tells Exponential not to let anyone inside Exponential unless they're logged into the system.

file: settings/siteaccess/www/site.ini.append

[DesignSettings]
SiteDesign=mybookstore

[SiteAccessSettings]
RequireUserLogin=false

The settings above applies to the website. SiteDesign=mybookstore means that Exponential will prefer to use the design for the site found in design/mybookstore, RequireUserLogin=false is set so that users do not have to log into Exponential to browse the website.

Host Match Map

In the previous example we used a regexp to map part of the url to different sites. This is a very powerful way of matching, but if you do not have experience or do not understand regexp, this approach might be difficult. Instead of regexp we can make a list of URL's and tell Exponential 3 to match them to a site. See the configuration example below.

file: settings/site.ini

[SiteAccessSettings]
MatchOrder=host
HostMatchType=map
HostMatchMapItems[]=mybookstore.com;user
HostMatchMapItems[]=www.mybookstore.com;user
HostMatchMapItems[]=admin.mybookstore.com;admin

As you might see from the example we mapped 'mybookstore.com' and 'www.mybookstore.com' to the user site and 'admin.mybookstore.com' to the admin site. To make individual settings for the two sites edit 'settings/siteaccess/user/site.ini.append' and 'settings/siteaccess/admin/site.ini.append'. The site.ini.append will override settings from 'settings/site.ini'

URI

We will stick with the www.mybookstore.com example, but now we will use URI to recognize the different sites. http://www.mybookstore.com/index.php/admin will be our URL to the admin site and http://www.mybookstore/index.php the URL to our user site. Here we only need the 'www.mybookstore.com' domain to point to our web server. In settings/site.ini set these settings:

file: settings/site.ini

[SiteSettings]
DefaultAccess=user

[SiteAccessSettings]
MatchOrder=uri

With the DefaultAccess variable we told Exponential to use the 'user' site if it is unable to match a site. Now Exponential will take the last part of the entered URL and map it do a directory under settings/siteaccess/. If we now enter http://www.mybookstore.com/index.php/admin, Exponential will look for a directory called 'admin'. Using URI is useful when you want multiple sites but don't have a domain for each site or don't have the ability to setup virtual hosts for each site. This is the configuration the Exponential Windows installer uses.

Port

By setting up site access to use ports we can let Exponential distinguish different sites by mapping a port to a site. In this example we will use port 80 for the user site and port 81 for the admin site. When the configuration is done we should be able to access the user site on http://www.mybookstore.com:80 and the admin site with http://www.mybookstore.com:81. The settings in settings/site.ini required for this setup is shown below.

file: settings/site.ini

[SiteAccessSettings]
MatchOrder=port

[PortAccessSettings]
80=user
81=admin

Debug

If you have problems getting your site access configuration right, you can turn on site access debugging. There are two settings for this. DebugAccess prints out the site access that was chosen, and DebugExtraAccess prints some extra information on access matching.

file: settings/site.ini

[SiteAccessSettings]

DebugAccess=enabled
DebugExtraAccess=enabled

Exponential copyright © copyright � 1998-2025 Exponential