Webasyst framework allows you to use the entire address space, available at the original installation URL, to create new websites. For example, if Webasyst is installed at http://www.domain.com/, then individual pages and website sections can have arbitrary addresses "within" that URL: http://www.domain.com/about/, http://www.domain.com/shop/adidas/superstar/, http://www.domain.com/index.php?product=aeron-chair, http://www.domain.com/blog/2011/?tag=dev, etc. The exception from this rule is the Webasyst backend, because all its URLs will always point to the backend, and you cannot use them for the frontend.
Webasyst always analyzes a URL received from the browser by splitting it into two parts:
1) main part: it is the Webasyst installation URL including its domain name; in the above example it is http://www.domain.com/
2) internal part: it is the remaining part following the Webasyst installation URL; in the above examples it is about/, shop/adidas/superstar/, index.php?product=aeron-chair, etc.
The combination of these two URL parts defines which application will process the request in accordance with the routing rules contained in
system file system
wa-config/routing.php. The Site app offers tools for editing routing settings via a web interface and saves
changes in that file. Read about the technical details of the routing system in developer documentation →.
(main URL part)
Every instance of the Webasyst framework allows you to create an unlimited number of websites on different domain names. For example, domain1.com, subdomain.domain2.com, any-other-address.org — all these websites can be powered by a single instance of the Webasyst framework. To connect a new website to the your Webasyst, the following actions must be completed in the Site app:
a) add the domain name:
b) connect (map) the domain name to the web hosting server, where Webasyst is installed, so that your Webasyst becomes accessible on this domain name in a browser. You may need to consult your web hosting support team on how to connect a domain name to the web hosting server.
A new website is added by the Site app to the system routing file
Routing and application settlement
(internal URL part)
The Site app allows adding an arbitrary number of routing rules for each website (domain name), which will later define the processing order of URLs by the available Webasyst applications.
In this example any URL satisfying condition domain.com/shop/* will be processed by the Site app, URLs within domain.com/blog/* — by the Blog app, and all other URLs will be processed by the Site.
If, in the above example, a user attempts to open domain.com/contacts.aspx, he or she will be redirected (by means of an HTTP redirect) to
the page located at domain.com/contacts/, which (according to rule
domain.com/*) will be processed by the Site app. In this example
contacts.aspx is regarded by Webasyst as a simple text string and not as a request to a remote web resource (some more examples:
about.php, special-offers.html, index.php?params=value, etc.). Rules can be specified in
absolutely any form. For example, if you add rule
/about/, no real folder named about/ is actually created on the server. A rule is only a template
used to analyze the URLs used by website visitors.
Rules are processed one by one in the order specified in file
wa-config/routing.php (as displayed in the Site app settings). If a rule is
encountered, which satisfies the current user request, then the corresponding application continues to process the request, and all other rules are ignored.
To allow matching of an arbitrary group of symbols, use
* (asterisk). For example, rules
shop/* are different, because
the former one satisfies only one URL: domain.com/shop/, and the latter one matches any URLs within shop; e.g.,
domain.com/shop/index.php?param=value, and others. The part of the URL following shop/ is forwarded to the application
to which this routing rule is connected, and then the application "decides", what exactly should be done (what page should be opened and what actions should be
Applications combined within a website by different routing rules work independently and can not interact with each other at all. You can think of this situation like of a web server, where different scripts (probably even created by different developers) are installed in separate subfolders; however, they can be operating independently and can be "integrated" into one website only through setup of similar design with links to each other and, optionally, data exchange.
The term "settlement" is rather informal, but it very well reflects the idea of connectin application frontends within the website frontend. By connecting an
application with a routing rule, you actually settle it on your website. You can install only one instance of each Webasyst application and yet have several settlements,
i.e. occupy several address subspaces. For example, you can connect the Blog app on the website at several URLs (using different rules):
/photoblog/*, etc. And you can even apply different design
to each such settlement. This is achieved through availability of an individual set of parameters for each settlement: selected design theme, application settings,
For easier creation of websites with several settlements you can use the array returned by function
$wa->apps(). The main navigation
menu of the website will be generated according to the structure of that array. By default the navigation array is automatically defined based on the routing rules
and, hence, reflects your website's current routing settings. You may also want to choose from automatic to manual propagation of the array returned by
$wa->apps(); this will not impair the operation of your website in any way.