Access methods
When a request arrives, Exponential has to decide which siteaccess answers it. It looks at the request's path, host name or port, in an order you choose, and takes the first siteaccess that matches. The rules are in site.ini [SiteAccessSettings], in settings/override/site.ini.append.php, because they are needed before any siteaccess is known.
The match order
MatchOrder lists the methods to try, separated by semicolons; the default is uri;host;port. Each method is tried in turn until one gives a siteaccess listed in AvailableSiteAccessList[]. When none matches, [SiteSettings] DefaultAccess is used.
| Method | Looks at | Settings |
|---|---|---|
| uri | The start of the path: example.com/admin/... | URIMatchType: element (the first path element is the siteaccess name), map (URIMatchMapItems[]=path;siteaccess), text or regexp; disabled switches it off |
| host | The host name: admin.example.com | HostMatchType: map (HostMatchMapItems[]=host;siteaccess), element, text or regexp |
| host_uri | The host and the first path element together: example.com/ger | HostUriMatchMapItems[]=host;uri;siteaccess |
| port | The port of the request | [PortAccessSettings] 8081=admin |
| servervar | A server variable set by the web server | ServerVariableName (default SITEACCESS) |
Three common layouts
# One host, the siteaccess as the first path element: # https://example.com/site/... https://example.com/admin/... [SiteAccessSettings] MatchOrder=uri URIMatchType=element
# A host per siteaccess [SiteAccessSettings] MatchOrder=host HostMatchType=map HostMatchMapItems[] HostMatchMapItems[]=www.example.com;site HostMatchMapItems[]=admin.example.com;admin HostMatchMapItems[]=edit.example.com;editor
# A host per site, and a path per language [SiteAccessSettings] MatchOrder=host_uri HostUriMatchMapItems[] HostUriMatchMapItems[]=www.example.com;ger;site_ger HostUriMatchMapItems[]=www.example.com;eng;site HostUriMatchMapItems[]=admin.example.com;;admin
With uri matching, the siteaccess name stays in the addresses of that siteaccess (/admin/content/view/full/2). With host matching the addresses carry no siteaccess name, which is usual for public sites.
Things to watch
- A host map entry can end with a matching method: strict (the default), start, end or part. start and part also match hosts you did not mean, such as example.com.anything; use them only where your web server answers for your own hosts alone.
- Put more specific host_uri entries first: the list is read from the top.
- After changing the matching, clear the INI cache and try every address. If the administration no longer answers, correct settings/override/site.ini.append.php in a shell.
- Addresses without a siteaccess or language, such as example.com/, can be sent to the visitor's language with DefaultHostUriMatchMapItems[]; see Siteaccess by host prefix, and the redirect to the language.
Contributors
- Balazs Halasy
- Ricardo Correia Maintainer
- Geir Arne Waaler Maintainer
- Graham Brookins Updated Maintainer
Comments
Add a comment