Page Rules

Page rules are an incredibly helpful tool to change the behavior of smoxy for specific pages of your website.

Behavior

Page rules are executed for every single request that is send to smoxy and are evaluated from top to bottom. The first page rule that is enabled and matches your configuration will change the smoxy behavior accordingly and serve the request.

Therefor controlling the order of many page rules makes sense from time to time.

Adding a new page rule

Name the Page Rule

When creating a page rule, the name and description can be specified.

Define WHEN the rule should apply

Page rules are based on URLs and matcher to define when a rule should be applicable

The Matcher option will change how the URI is understood by the page rule.

  • Equals: Compares the request URI with your provided URI in the page rule. If both values are identical, the page rule will be executed.

  • Matches Regex: The page rule will be executed if the regex returns true, when applying it on the URI.

  • Matches Regex Case-Insensetive: The page rule will be executed if the regex returns true, when applying it on the URI, regardless if the URI is written in upper- or lowercase.

URL vs. URI

The URL identifies the web address of a unique page. For example: https://www.example.com/categorie/data.html

The URI simply identifies the destination without the domain or protocol. For example: /category/data.html

A RegEx or regular expression is a sequence of characters that form a search pattern. RegEx can be used to check whether a string contains the specified search pattern. For more information about regular expressions, visit websites such as https://regexr.com/.

You can use the URI field to provide the URI, or the regex for your page rule.

Following are examples of page rules for different Matchers. However you can find more examples in the Use Cases part of the Page Rules documentation.

  • If you want to match the URL example.com/myresource/data.php use Matcher Equals and URI /myresource/data.php

  • If you want to match the URL that starts with example.com/exports use Matcher Matches Regex and URI ^/exports

  • If you want to match the URLs that look like this example.com/Exports or even like example.com/exports you can use Matcher Matches Regex case-insensetive and URI ^/exports, because with the case-insensetive option the regex will become true for both cases.

Pick the settings applied with the rule

This is where you can take full control over your smoxy settings. Every configuration can be overwritten here. The only limitation is your imagination.

  • Do you need higher quality of images for a specific page? You could increase the JPEG, PNG and WebP Quality.

  • Don't want cache on a specific page? Disable the optimization? (example)

  • Do you have an URI that is called /blog and smoxy should send the traffic to a completely different server? Change the load balancer group. (example)

Available settings are grouped. If you want to know what a specific setting implies, check the Configuration Pages like Image Cache, HTML Cache, SSL or Loadbalancer.

Publishing and enabling page rules

When you save a new page rule, you have the option to activate it immediately. An inactive page rule can be activated on the overview page. If you encounter unexpected problems after creating a new Page Rule, you don't need to delete the rule immediately. Simply disable the Page Rule and check your configuration again.

Last updated