ez.no / exponential / documentation / configuration / configuration / site access
These documentation pages are no longer maintained. Please visit the new documentation site.
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. For normal, small sites we have usually two site accesses, the user site and the admin site.
In this example we will name our site www.example.com and we will use admin.example.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 add a section called [SiteAccessSettings] in your configuration file.
settings/override/site.ini.append:
[SiteAccessSettings] MatchOrder=host HostMatchRegexp=^(.+)\.example\.com$ HostMatchSubtextPost=\.example\.com
Here we told Exponential to take the part before .example.com of the url and map it to a directory in settings/siteaccess/. If we enter www.example.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 just like settings/override/site.ini.append, but will only work for the current site access. 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.
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.
settings/siteaccess/www/site.ini.append:
[DesignSettings] SiteDesign=mydesign [SiteAccessSettings] RequireUserLogin=false
The settings above applies to the website. SiteDesign=mydesign means that Exponential will prefer to use the design for the site found in design/mydesign/, RequireUserLogin=false is set so that users do not have to log into Exponential to browse the website.
In the previous example we used a regexp (regular expression) 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.
settings/override/site.ini.append:
[SiteAccessSettings] MatchOrder=host HostMatchType=map HostMatchMapItems[]=example.com;user HostMatchMapItems[]=www.example.com;user HostMatchMapItems[]=admin.example.com;admin
As you might see from the example we mapped example.com and www.example.com to the user site and admin.example.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.
We will stick with the www.example.com, but now we will use URI to recognize the different sites. http://www.example.com/index.php/admin will be our URL to the admin site and http://www.example.com/index.php the URL to our user site. Here we only need the www.example.com domain to point to our web server. Set these settings in our configuration file:
[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.example.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.
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.example.com:80 and the admin site with http://www.example.com:81. The settings in our configuration file for this setup is shown below.
[SiteAccessSettings] MatchOrder=port [PortAccessSettings] 80=user 81=admin
If all others fail, index parameters is one of the last options.
With the above settings, any adition to index_ 'll be used for access purposes. index_admin.php for admin, index_users.php for users. To use this, copy index.php to index_admin.php and index_users.php and rename
SiteURL=www.domain.tld/index.php AdminSiteURL=www.domain.tld/index.php/admin
to
SiteURL=www.domain.tld/index_users.php AdminSiteURL=www.domain.tld/index_admin.php
Unix: The best way to copy index.php is by creating a symbolic link: ln -s index.php index_admin.php . This way any change to index.php will be copied to all symbolic linked files.
Comments
Watch Out
Deane Barker
Friday 15 October 2004 4:59:34 pm
Be careful if you change access methods midstream, because your install most likely has pages cached with the prior access scheme hardcoded into URLs.
I switched to host access over URL access. However, when I went to login, I kept getting "Module not found," and the address bar of the browser would still have the URL path with the "index.php" in it. This is because a bunch of admin templates were cached with the old URL paths specified.
Just empty the cache, right? Not easy when your admin side doesn't work due to the very problem you're trying to fix. I couldn't get to the cache manage page without tripping over "Module Not Found" problems.
host and uri SiteAccessSettings
Alexandre Cunha
Saturday 27 March 2004 2:54:39 pm