URL Redirect


URL Redirect allows you to redirect client requests to defined targets, which may or may not be what the client requested. This feature is a very popular and should be used with some imagination and logic to get the best results.


Web Filter Proxy Interface Screen-shot - URL Redirecting
Web Filter Proxy Interface Screen-shot - URL Redirecting

Main Section

This option allows you to enable, or completely disable the URL Redirecting Section irrespective of the rules defined in the section

Yes - Enable URL Redirecting Section
No - Disable URL Redirecting Section

Sub Section

This option allows you to enable or disable a specific entry

Yes - Enable entry
No - Disable entry

A comment for future reference explaining what this rule does

LDAP Profiles
Comma separated list of LDAP Profiles to which this entry will be applicable. This entry will match if any of the LDAP Profiles specified here matches

A comma separated list of Profiles on which this rule should apply. The rule applies to every one if this field is left blank

A regular expression matching the URL you wish to redirect. The URL will always be in the form "protocol://host/file" or "/file" for HTTP requests. This may be trailed with a / followed by flag characters like in Perl to modify options used to compile the regular expression, and must be, if a / is used anywhere else in the regular expression.

The URL to redirect to. It may contain back references to strings captured using parenthesis in the URL pattern. This can be in the form "protocol://host/file" or "/file" if you wish to send a relative URL when redirecting a URL in the Location: header. If this option is left blank, no action will be taken against requests matching the URL

The port to redirect to. If left blank, the same port to which the original request was made, is used.

302 redirect
If yes, a 302 redirect is used; otherwise the new host is connected to directly and the new file is requested. A 302 redirect should always be used when possible to ensure relative links and images are correct.

The following options are available to control how the URL should be handled:

Encode URL - Encode the new URL.
Decode URL before - Decode the URL before attempting to match it with the regular expression.
Decode URL after - Decode the new URL after matching.

Applies to
Select whether the redirection applies to requested URL's, the Location header when a remote site sends a 302 redirect, or both.


SafeSquid automatically produces the auto-configure-script proxy.pac (Proxy Auto Configuration) file, that clients can use to automatically configure the proxy server. This file can also be used by WPAD (Web Proxy Automatic Discovery) protocol, which allows automatic discovery of Proxy servers. The following redirect rule will redirect any client request for proxy.pac file to the default SafeSquid proxy.pac file.

Web Filter Proxy Interface Screen-shot - URL Redirecting

See Enforcing Google, Yahoo and Bing SafeSearch for another example.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License