Contents...

Domains & routing (Site app)

The Webasyst framework can use the entire address space, available within its root URL, to power a website. For example, if it’s is installed at https://mydomain.com/ then individual site pages and sections can have arbitrary addresses within that URL; e.g., https://mydomain.com/about/, https://mydomain.com/shop/adidas/superstar/, https://mydomain.com/index.php?product=aeron-chair, https://mydomain.com/blog/2000/?tag=dev, etc. The exception to this rule is the backend because URLs occupied by the backend address space always point to the backend and cannot be used for the frontend.

Webasyst analyzes URLs received from the browser by splitting them into two parts:

  • Main part: it is the Webasyst root URL including its domain name; in the above example it is https://mydomain.com/.
  • Internal part: it is the remaining part following the root 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 app will process a particular HTTP request according to the routing rules contained in configuration file wa-config/routing.php. The Site app offers visual tools for editing routing settings via a web interface and saves them to that file. Read more about the routing system in a separate article.

Multi-site routing

Main URL part

Each installed instance of the Webasyst framework allows creating an unlimited number of websites on different domain names; e.g., domain1.com, subdomain.domain2.com, any-other-address.org — all these websites can be powered by a single installed instance Webasyst. To connect a new website to your Webasyst account, the following actions must be completed in the Site app:

  1. Add a new site:
  2. Connect (map) the domain name to the web-hosting server, where Webasyst is installed, so that your Webasyst account becomes accessible at that domain name in a browser. You may need to consult your web-hosting support team on how to connect a domain name to a web-hosting account.

Multi-app routing within a site

Internal URL part

The Site app allows setting up an unlimited number of routing rules for each website, which define the processing order of HTTP requests by installed Webasyst apps.

In the example below, all URLs matching the domain.com/shop pattern will be processed by the Shop-Script app, those matching domain.com/blog will be processed by the Blog app, and all other URLs will be processed by Site because its page is selected as the site’s homepage.

Rules are processed one by one in the order specified in file wa-config/routing.php (which is the reverse of that displayed in the Site app). If a rule matching the current request’s URL is encountered then that rule’s app continues the request processing, and all remaining rules are ignored.

Each app can have only one installed instance within a Webasyst account and yet have several routing rules set up for it, i.e. occupy several address subspaces. For instance, you can connect the Blog app to several URL patterns: /blog/ru, /blog/en, /photo-blog, etc. You can even apply different design to each of these site sections. This is achieved through an individual set of various parameters available for each site section such as design theme, app settings, custom parameters.

Routing mode in the Site app

In the Site app’s Site map section the advanced routing management mode is also available.

Routing management mode switch in the Site app

Its features:

  • Routing rules are listed in the same order as in configuration file wa-config/routing.php — from most detailed ones at the top to more common ones at the bottom (unlike the default mode, in which the reverse order is used for convenience — with the home page’s shortest address at the top and the rest of rules with longer and more detailed addresses at the bottom).
  • The displayed list contains both ordinary site sections and additional rules that are available in the Settings section: apps on the site, redirects, custom files in site root.
  • For site sections and apps on the site * characters are shown that are used as a wildcard.
  • The main Add rule button allows adding any types of rules (not only site sections available in the default site map management mode).
List of routing rules in the Site app