URL\_LFS\_REWRITE(8) User Contributed Perl Documentation URL\_LFS\_REWRITE(8)

# [NAME](#NAME)

```
 url_lfs_rewrite - a URL-rewriter based on local file existence
```

# [SYNOPSIS](#SYNOPSIS)

```
 url_lfs_rewrite [--debug] --local-dir=/var/www/ [options]
```

# [DESCRIPTION](#DESCRIPTION)

Direct all request to files who are in a local directory to a local web server hosting this directory.

This program uses Squid concurrency support.

# [OPTIONS](#OPTIONS)

[**--debug**](#debug)

Write debug info to stderr.

[**--local-dir**](#local)

Directory path under which the scripts searches for files.

[**--to-scheme**](#to)

Scheme to use for the redirected URL.

```
 Default: http
    
```

[**--to-host**](#to~2)

Domain name to use for the redirected URL.

```
 Default: localhost
    
```

[**--to-path**](#to~3)

URL path to add as prefix for the redirected URL path.

If set it must end with a '/'.

```
 Default: use the original URL path.
    
```

# [KNOWN ISSUES](#KNOWN_ISSUES)

\* The --local-dir parameter must end with a '/'. Otherwise no  
file paths will be found.

\* URL with no filename in the path can match directories on the local  
filesystem and be wrongly redirected to the local web server.

\* Any scheme name accepted by the Perl URL library can be used  
as the --to-scheme parameter. However only schemes supported by  
Squid will work.

\* URL containing query-string are not handled well and will not  
be rewritten even if the base script or file exists on the local  
system.

# [CONFIGURATION](#CONFIGURATION)

```
  url_rewrite_program /path/to/url_lfs_rewrite --local-dir=\var\www\localhost
  url_rewrite_children 20 startup=1 idle=1 concurrency=25
  url_rewrite_access deny CONNECT
  url_rewrite_access deny to_localhost
```

This helper can redirect to any web server but only does so if there is a file matching the URL path segment in the local filesystem. Normal configuration requires a web server running on localhost serving up files from a local disk (eg. \\var\\www\\localhost). Configuration of that web server is not covered here.

# [AUTHOR](#AUTHOR)

This program and documentation was written by *Amos Jeffries &lt;squid3@treenet.co.nz*&gt;

Based on prior work in **rredir.pl** by *Peter Eisenhauer &lt;pe@pipetronix.de*&gt;. First Version: 26. May 1997

# [COPYRIGHT](#COPYRIGHT)

```
 * Copyright (C) 1996-2026 The Squid Software Foundation and contributors
 *
 * Squid software is distributed under GPLv2+ license and includes
 * contributions from numerous individuals and organizations.
 * Please see the COPYING and CONTRIBUTORS files for details.
```

# [REPORTING BUGS](#REPORTING_BUGS)

Bug reports need to be made in English. See https://wiki.squid-cache.org/SquidFaq/BugReporting for details of what you need to include with your bug report.

Report bugs or bug fixes using https://bugs.squid-cache.org/

Report serious security bugs to *Squid Bugs &lt;squid-bugs@lists.squid-cache.org*&gt;

Report ideas for new improvements to the *Squid Developers mailing list &lt;squid-dev@lists.squid-cache.org*&gt;

# [SEE ALSO](#SEE_ALSO)

[squid (8)](/man/os/squid/squid.8), [GPL (7)](/man/os/squid/GPL.7),

The Squid FAQ wiki https://wiki.squid-cache.org/SquidFaq

The Squid Configuration Manual http://www.squid-cache.org/Doc/config/

2026-06-07 perl v5.42.2

---

Document: url_lfs_rewrite(8) from squid 7.6-r0 (Chainguard OS)
Source: https://github.com/squid-cache/squid.git
