Create and Manage Websites

When a domain rule set matches, Snap generates a canonicalized domain name which it uses to access a website rule set. (The snap-manager tool will soon offer a way to test your domain names to see what the canonicalized version really looks like, but it should as you expect... everything except the flags.)

Once the name of a website rule set was determined, it can be added using the Websites tab of the snap-manager tool. As you can see, like with the domains, you have a New button at the bottom of the tab. Click on it to create a new website entry.

The rules are very similar to those found in the domain definitions with the addition of the protocol, port, path and query keywords. (See the URL Test page for details.)

Unless you allow multiple protocols and ports, those two options are not required.

A protocolo can be specified with the following statement:

protocol = "https";

The currently supported protocols are http and https. You can also use "any" or "http|https" to support both protocols in a given website.

The port can be specified with the following statement:

port = "80";

Note that the port is a number, although we only support strings in our syntax. Also, later we may support regular expressions as a port definition. Note that the default port is expected to be 80 but it is not checked if not defined (i.e. any port will be accepted.)

The path and query keywords are used to define the path (/a/b/c...) and query (?q=123) information that needs to match for this very website to be picked.

Note that if your entire domain covers one website and the sub-domain was already covered in the domain definition, then the path and query do not apply. Otherwise, in most cases it will only define a sub-domain. The rest will be the default.

path required sub_domain = "snap/website";

This is certainly the simplest example to get you started.

Syndicate content

Snap! Websites
An Open Source CMS System in C++

Contact Us Directly