Skip to main content

How to Configure Web Rules for Your Cloudways Velocity Application

Learn how to create and manage header and rewrite rules for your Cloudways Velocity application directly from the Cloudways Platform.

Written by Syed Abuzar Mehdi

The Web Rules section allows you to control how your Cloudways Velocity application responds to incoming requests.

You can create rules directly from the Cloudways Platform without manually changing server configuration files. Web Rules can be used to:

  • Add or change response headers.

  • Redirect visitors from one URL to another.

  • Control whether URL query information is retained.

  • Apply a rule only when a specified condition is met.

  • Edit, delete, search, and reorder existing rules.

The section contains two types of rules:

  • Header Rules

  • Rewrite Rules

Note:

Web Rules is currently available as a Public Preview feature. Its interface, limits, or available options may change as the feature develops.


Before You Begin

Before creating a rule:

  • Confirm the exact behavior you want to configure.

  • Test the source and destination URLs.

  • Make sure the new rule does not conflict with an existing application route.

  • Review existing rules before adding another one.

Important:

An incorrectly configured rule may change application responses, create a redirect loop, or make a page unavailable. Test new rules after saving them.


Access Web Rules

  • Log in to the Cloudways Platform.

  • From the left navigation menu, select Velocity.

  • Select My Applications.

  • Choose the required application.

  • From the application management menu, select Web Rules.

  • The Web Rules page contains the following tabs:

    • Header Rules

    • Rewrite Rules


Manage Header Rules

  • Navigate to: Velocity → My Applications → Select Application → Web Rules → Header Rules

  • A response header provides additional information with an application response. Headers can control browser behavior, security settings, caching, content handling, and other request or response behavior.

  • The Header Rules tab allows you to create and manage custom response headers.

Add a Header Rule

  1. Open the Header Rules tab.

  2. Select Add Header Rule. If rules already exist, select Add Rule.

  3. Complete the following fields.

Type

  • Select the type of header rule.

  • The screenshot shows Custom, which allows you to enter your own header name and value.

Action

  • Select the action Cloudways should perform on the header.

  • The screenshot shows Set, which adds the header or replaces its existing value.

Header Name

  • Enter the name of the response header.

  • For example: X-Content-Type-Options

  • Use a valid header name without unnecessary spaces or special characters.

Value

  • Enter the value that should be returned with the header.

  • For example: nosniff

  • The required value depends on the header being configured.

Always Apply

Choose whether the header should be added to every matching response.

  • True: The rule is always applied.

  • False: The rule is applied only when supported conditions or behavior allow it.

  • To create more than one rule in the same process, select Add Another Web Rule.

  • Now, click on Add Rules.

Understand the Header Rules Table

The table displays:

  • Action: What Cloudways does with the header.

  • Header Name: The name of the configured header.

  • Header Value: The value returned with the header.

  • Always Apply: Whether the rule is applied consistently.

The page also displays the number of rules still available. Based on the current interface, you can configure up to 10 Header Rules for an application.

For example, 9/10 Rules Remaining means one rule has been created and nine additional rules can still be added.

Edit or Delete a Header Rule

  1. Locate the required rule.

  2. Open the three-dot menu.

  3. Select:

    1. Edit to change the rule.

    2. Delete to permanently remove it.

Note:

Test the application after editing or deleting a rule.


Manage Rewrite Rules

  • Navigate to: Velocity → My Applications → Select Application → Web Rules → Rewrite Rules

  • Rewrite Rules control how application URLs and requests are handled.

They can be used to:

  • Redirect an old URL to a new URL.

  • Send visitors to another domain.

  • Change the destination of a request.

  • Retain or remove query information.

  • Apply the rule only to a specified host or another supported condition.

Note:

Although the section is named Rewrite Rules, the current interface also supports redirect actions.

Add a Rewrite Rule

  • Open the Rewrite Rules tab.

  • Select Add Rewrite Rule.

  • Complete the following fields.

Action

Select how the request should be handled.

The screenshot shows:

  • Permanent redirect (301 status code)

  • A 301 redirect sends visitors and search engines permanently from the source URL to the destination URL.

  • Use a permanent redirect only when the old location should no longer be used.

Keep or Discard Original Query String

  • A query string is information added after a question mark in a URL.

  • For example: example.com/search?category=books

  • In this URL, category=books is the query string.

Choose:

  • True: Keep the original query string when redirecting.

  • False: Remove it from the destination request.

Source

  • Enter the path from which requests should be redirected.

  • Example: /old-page

  • The source normally begins with a forward slash.

Destination

  • Enter the full destination URL.

  • Example: https://www.example.com/new-page

  • Include https:// when redirecting to a full external or application URL.

Attach a Condition to a Rewrite Rule

Enable Attach condition when the rule should apply only to specific requests. When enabled, complete the following fields.

Condition Type

  • Select the request detail that Cloudways should check.

  • The screenshot shows Host.

  • A host is the domain or hostname used to access the application, such as example.com.

Operator

  • Select how the entered value should be compared.

  • The screenshot shows: Equals (=)

  • This means the rule is applied only when the host exactly matches the entered value.

Host

  • Enter the hostname that must match.

  • Example: example.com

  • Do not include https:// or a page path when the condition expects only a hostname.

After completing the rule:

  1. Select Add Another Web Rule to configure another rule during the same process, or

  2. Select Add Rules to save it.

Rewrite Rule Example

The following example permanently redirects:

https://example.com/old-page

to:

https://www.example.com/new-page

while keeping the original query string.

Configure:

  • Action: Permanent redirect (301 status code)

  • Keep query string: True

  • Source: /old-page

  • Destination: https://www.example.com/new-page

  • Attach condition: Enabled

  • Condition Type: Host

  • Operator: Equals

  • Host: example.com


Understand the Rewrite Rules Table

The table displays information such as:

  • Action: The redirect or rewrite behavior.

  • Source: The original request path.

  • Destination: Where the request is sent.

  • Original Query String: Whether the original query information is kept.

  • Conditions: Requirements that must be met before the rule applies.

The page also displays the remaining rule allowance. Based on the current interface, you can configure up to 25 Rewrite Rules for an application.

For example, 24/25 Rules Remaining means one rule is already configured.

Edit or Delete a Rewrite Rule

  1. Locate the required rule.

  2. Open the three-dot menu.

  3. Select:

  • Edit to modify it.

  • Delete to remove it.

After changing a redirect rule, test the source URL in a private browser window.

Search and Reorder Rules

  • When several rules exist, use the search icon to locate a particular rule.

  • The Re-order option allows you to change the sequence in which rules are evaluated. This is important when multiple rules may match the same request.

  • A more specific rule should normally appear before a broader rule.

For example:

  • /products/sale

  • /products

Place /products/sale first when it requires different behavior.

Important:

Rule order can affect which action is applied. Review and test the application after reordering rules.


Recommended Practices

  • Use clear and valid header names and values.

  • Create permanent redirects only when the source URL has permanently moved.

  • Avoid creating one redirect that sends visitors back to its original source, as this can create a redirect loop.

  • Use conditions when a rule should apply only to a specific domain.

  • Keep query strings only when the destination needs the information they contain.

  • Check existing rules before adding a new one to prevent conflicting behavior.

  • Test important routes, API endpoints, and application pages after every change.

  • Delete unused rules to keep the configuration easier to understand.


Frequently Asked Questions

What is the difference between a Header Rule and a Rewrite Rule?

A Header Rule changes information returned with an application response. A Rewrite Rule changes how an incoming URL or request is handled.

What does a 301 redirect mean?

A 301 redirect indicates that a URL has moved permanently to another location. Browsers and search engines may begin using the new destination instead of the old URL.

Should I keep the original query string?

Keep it when the destination requires the same tracking, filtering, or request information. Discard it when that information is not required or should not be passed to the destination.

What does Always Apply mean in a Header Rule?

It determines whether the configured header should consistently be added to supported responses.

What is a host condition?

A host condition limits the rule to requests made through a specified domain or hostname.

How many rules can I create?

The current interface shows limits of:

  • 10 Header Rules

  • 25 Rewrite Rules

The remaining allowance appears beside each rule type.

Can I edit a saved rule?

Yes. Open the three-dot menu beside the rule and select Edit.

Why is Re-order unavailable?

The option may remain unavailable when only one rule exists. It becomes useful when multiple rules can be placed in a different order.

What should I do if a redirect creates a loop?

Edit or remove the rule immediately. Confirm that the destination does not redirect back to the source URL.


That’s it! We hope this article was helpful.

Did this answer your question?