Technical Tip: Import URL list into a Web Filter category
| 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:
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:
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
Host URL List: Place list of URLs in a text file on an external web server.
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. |
