How to use Web Server Rule Generator
- Choose nginx server block or Apache 2.4 domain-root .htaccess, then select Redirect or Cache.
- Enter one literal root-relative path. For Redirect, choose the destination and status; for Cache, use a supported public static-asset path and whole cache days.
- Select Generate server rules. Copy the snippet or download nginx-snippet.conf or apache-snippet.htaccess for the selected server.
- Review the surrounding configuration and run the server’s syntax check before activation. Test matching and nonmatching paths and the actual response; this generator changes no settings.
Example: Web Server Rule Generator
Generate an exact nginx redirect from /old-page to a fixed HTTPS destination.
Options
- Server context
- nginx snippets belong inside the intended server block. Apache snippets target a domain-root .htaccess: redirects need mod_rewrite; cache rules need mod_headers and an allowed override context. Existing root/alias, rewrite and access rules still matter.
- Redirect query and status
- The entered destination replaces the original query string, retaining any query written in the destination. Choose 301, 302, 307 or 308 deliberately; 307 and 308 preserve the request method. Only one exact source path is generated.
- Static caching
- Choose one public CSS, JS, PNG, JPEG, WebP, SVG, ICO or WOFF2 asset and 0 to 365 whole cache days. This does not create a policy for dynamic or authenticated responses. The nginx form also checks that the requested file exists.
Supported inputs and limits
- One literal ASCII root-relative path up to 1,024 UTF-8 bytes and, for redirects, an absolute HTTP(S) destination up to 2,048 bytes without credentials.
- Queries in source paths, percent escapes, dot segments, duplicate slashes, regex input and directive/interpolation characters are refused.
- Supported contexts are nginx server blocks and Apache 2.4 domain-root .htaccess.
- Output is generated text: no server inspection, syntax check, activation, bulk rules, security policy or compression configuration is performed.
Where your input is processed
This tool does not upload your inputs. See the limits for anything saved on your device.
Test an exact rule before broadening it
The generated snippet does not change any server. Review syntax in the intended version and context, test the matching path and a nonmatching path, and inspect the actual redirect status and destination. Static caching applies to the exact named public asset; it is not a policy for authenticated or dynamic pages.
Questions about Web Server Rule Generator
Will generating a rule change my server?
No. The result is a text snippet for you to review.
Can I paste a regular expression or directive?
No. These fields accept the documented literal choices and reject configuration injection.
Can static-cache rules be used for account pages?
No. They are scoped to the named static-asset case; dynamic or private responses need their own policy.