FortiWeb
A FortiWeb can be configured to join a Security Fabric through the root or downstream FortiGate.
kmak
Staff
Staff
Article Id 356649
Description This article describes the steps to use the rewrite rule in FortiWeb to redirect root directory URL to subdirectory URL.
Scope FortiWeb.
Solution

Prerequisites:

  • Backend Real Server application behind FortiWeb does not have its own URL Rewriting rule.

 

There are cases where a landing page which initially places at the root directory of a domain website, and users wish to migrate to a sub-directory of the domain website.

Using the URL Rewrite rule, redirect the HTTP request from the root directory to the sub-directory URL.

 

  1. In the FortiWeb GUI, navigate to the URL Rewriting configuration page under the Application Delivery category. Create a new URL Rewriting Rule in the page.

kmak_0-1731207166607.jpeg

 

  1. Insert a name for the rewrite rule, select Request Action as the action type, and select the Redirect (301 Permanently) as the request action.
kmak_1-1731207166611.jpeg

 

  1. In the URL Rewriting Condition Table, create the matching condition as below:
  1.  

Object: HTTP Host

Regular Expression: (.*)

*Regular expression to match HTTP requests with any hostname.

 

  1.  

Object: HTTP URL

Regular Expression: ^/$

*Regular expression to match HTTP requests URL of root directory only.

 

kmak_2-1731207166615.jpeg

 

  1. After creating the URL rewriting rule, navigate to the URL Rewriting Policy tab and create a new policy and associate the URL rewriting rule.

kmak_3-1731207166617.jpeg

 

  1. Go to the Web Protection Profile page and edit the profile which the server policy’s website requires the redirection. Select the URL rewriting policy in the web protection profile.
kmak_4-1731207166622.jpeg

 

  1. The rewrite rule and policy will be effective after enabling the policy in the Web Protection Profile. Test browse the website to verify the redirect.
  1. Browser test.

kmak_5-1731207166623.jpeg
kmak_6-1731207166625.jpeg

  1. cURL test.


kmak_7-1731207166626.jpeg

 

Related document:

Contributors