Created on
09-28-2025
10:14 PM
Edited on
09-29-2025
08:02 AM
By
Jean-Philippe_P
Description | This article describes how to add 'www' to the beginning of a URL and configure URL redirection rules in FortiWeb. |
Scope | FortiWeb. |
Solution |
There are scenarios where it's wanted to add 'www' to a published URL through FortiWeb, for example, from 'http://anydomainabced.com' to 'http://www.anydomainabced.com', and then maintain this new domain name with 'www' when other URLs in the same domain name are requested. It is possible to do this using URL redirection rules.
Configure the following parameters in the New URL Rewriting Rule:
In the URL Rewriting Condition Table, the 'Create New' button is now enabled; select this button. In New URL Rewriting Condition, configure the following settings (keeping in mind the example URL is http://anydomainabced.com).
The URL Rewriting Condition Table will show the recently created HTTP Host object.
In the URL Rewriting Condition Table, verify the HTTP Host object IS ABOVE the HTTP URL object in the list (those two entries must be in that order).
Location: http://www.anydomainabced.com/$0 (If the URL direction will use HTTPS, change http to https). When it is finished, select OK.
Write a name to the New URL Rewriting Policy and then select OK.
Configure this URL redirection policy in the Web Protection Profile used in the respective server policy.
Alternative configuration: Another option to add www to the domain name is enabling Redirect Naked Domain in the server policy; in an HTTP content routing policy, enable this option only if all domains need to be redirected to the naked domain. The Redirect Naked Domain is only available in Reverse Proxy mode.
If only an HTTP Content routing policy needs to be added 'www' in the domain name, create a separate web protection profile and apply a URL rewriting rule to it. Then, associate the newly created web protection profile with the content routing policy by disabling the 'Inherit Web Protection Profile' option.
Commands to enable redirect-naked-domain:
config server-policy policy edit <Policy_name> set redirect-naked-domain enable end end
Commands to disable Inherit Web Protection Profile for content routing policy:
config server-policy policy edit <Policy_name> config http-content-routing-list end end
Related documents: |
The Fortinet Security Fabric brings together the concepts of convergence and consolidation to provide comprehensive cybersecurity protection for all users, devices, and applications and across all network edges.
Copyright 2025 Fortinet, Inc. All Rights Reserved.