FortiGate
FortiGate Next Generation Firewall utilizes purpose-built security processors and threat intelligence security services from FortiGuard labs to deliver top-rated protection and high performance, including encrypted traffic.
_mribwan
Staff
Staff
Article Id 338650
Description This article describes how to block all sub-directories of a site using Regular Expression (Regex).
Scope FortiGate URL Filter.
Solution

This step requires Deep packet inspection to be enabled: Technical Tip: 'certificate-inspection' and 'deep-inspection' for URL filtering

 

Using Wildcard will result in the domain being blocked even if '/' is not in the main URL. For example, the following URL filter will be blocked even though the accessed site does not contain '/': 

 

Screenshot 2024-09-03 165456.png

 

Screenshot 2024-09-03 165525.png

 

This Regular Expression (Regex) is required in this case. The following Regex is used: lowyat\.net/.+

 

URL Filter configurationURL Filter configuration
/.+: matches a forward slash followed by one or more characters, which matches any subdirectory or file under the domain.
\.: matches the character '.'.

 

Result:

 

Main domain is accessibleMain domain is accessible

 

Sub-directory is blockedSub-directory is blocked

 

Webfilter logsWebfilter logs

Contributors