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.
bmedikonda
Staff
Staff
Article Id 389760
Description This article explains how to redirect users from a blocked website to a specific URL using the replacement message functionality in FortiGate. This is applicable when there is a requirement to guide users to an alternative site when accessing blocked URLs.
Scope

Generally, to redirect from one URL to another URL, it has to be done from DNS server end. However from the FortiGate any blocked page can be redirected to an specific URL by using replacement messages. However, every URL that is blocked will be redirected to that URL as the setting for replacement message is global.

 

Note:

This applies globally to all blocked URLs. It is not possible to configure per-domain redirects from the FortiGate replacement message.

 

Steps:

  1. Block the domain to be redirected:

    Go to Security Profiles -> Web Filter -> Static URL Filter and create a new entry:

    • URL: *example.com* > Mention any URL you want to block

    • Type: Wildcard

    • Action: Block

  2. Edit the replacement message:

    Go to System -> Replacement Messages -> HTTP -> URL Block Page.

  3. Add the redirect script:

    In the HTML source code of the replacement message, locate the <head> section and add the following code below it:

<script>

window.location.href = "https://www.google.com";   <----- Mention any URL to redirect the blocked URL.

</script>

 

This JavaScript will automatically redirect the browser to https://www.google.com when any blocked site is accessed.

video1.gif

 

Once a user attempts to access example.com, FortiGate will block the access based on the static URL filter. In this example, instead of showing the default block message, the browser will automatically redirect the user to https://www.google.com

 

Related documents:
Replacement messages | FortiGate / FortiOS 7.2.3

Technical Tip: How to create a replacement message that redirects the user to another website with F...