Skip to main content
Staff
July 30, 2025

Technical Tip: Import URL list into a Web Filter category

  • July 30, 2025
  • 0 replies
  • 1121 views
Description This article describes how to import a URL list into a web category locally on FortiGate without adding each URL manually.
Scope FortiGate v7.0 and above.
Solution

To import a URL list into a web category locally on FortiGate without adding each URL manually, use the following methods:

 

  1. Local Script Method:

Script the URLs: Each URL should be added to a custom category using the following command format:

 

config webfilter ftgd-local-rating

    edit "www.example.com"

        set rating 140 # Replace 140 with custom category ID

    next

end

 

Batch Processing:

To automate the creation of CLI commands for batch processing URLs into a FortiGate web category, follow these steps:
 
  • Prepare URL List: Start with a plain text file containing all the URLs to add, each on a new line.
  • Use Text Editor: Open the file in a text editor like Notepad++.
  • Find and Replace: Use the Find and Replace feature to format each URL into a CLI command.

For example, if URLs are listed as: 

 

www.example1.com  

www.example2.com  

www.example3.com  

 

Replace each line with: 

 

config webfilter ftgd-local-rating

    edit "<URL>" set rating 140

        next

    end

 

Example Replacement:

 

Use the following Find and Replace pattern in Notepad++: 

 

config webfilter ftgd-local-rating

    edit "\1"

        set rating 140

    next

end

 

Execute in the CLI: Copy the formatted commands and paste them into the FortiGate CLI to add all URLs to the desired category. 

 

Example Output: 

 

config webfilter ftgd-local-rating

    edit "www.example1.com"

        set rating 140

    next

end

 

config webfilter ftgd-local-rating

    edit "www.example2.com"

        set rating 140

    next

end

 

config webfilter ftgd-local-rating

    edit "www.example3.com"

        set rating 140

    next

end

 

  1. External Feed Method:

Host URL List: Place list of URLs in a text file on an external web server.

  • Configure External Resource: Use the FortiGate CLI to configure an external resource to import the URL list:

 

config system external-resource

    edit "external_resource_name"

        set type category

        set category 111 --> Use an appropriate category ID

        set resource "http://server.com/list.txt"

        set server-identity-check none

    next

end

 

Apply in Web Filter: The URLs will be imported into a remote category, which allow or exempt in web filter profile.

 

The External Feed Method is generally more scalable and easier to manage for large lists of URLs.

    Thought Leadership Security Summit. Outpace New Threats with AI - enhanced defense. Tuesday, Septmeber 15, 8:30 AM - 2:30 PM PT. The Golf Club at Newcastle, WA.
    Fortinet Flag the Hack. Wednesday, August 26, 9:00 AM - 5:00 PM ET, COSM, Atlanta, GA.