What the Redirect Rule Generator Does
The Redirect Rule Generator is a specialized tool designed to simplify the process of creating web server configuration rules for website redirection. When you migrate a website, restructure its URL architecture, or clean up old content, you often need to point old website addresses to new destinations.
This tool takes a list of website addresses you want to redirect from and the new addresses you want them to go to, then generates the specific code needed to make those redirects happen on your web server or hosting platform. To use the tool, you provide this list in a CSV file, choose whether the redirects are permanent or temporary, and select your web environment. The tool then displays the generated rules, which you can copy or download.
Preparing Your Redirect Mapping CSV
To generate redirect rules, you must upload a CSV file containing your URL mappings. The tool processes this file according to specific formatting rules and limitations:
- Header Row Requirements: The CSV file must contain a header row with
sourceandtarget(ordestination) columns. If these columns are missing, the tool displays the error: The header row needs source and target (or destination) columns. - Row Structure: Each row after the header must contain both a source URL and a destination URL. If a row is incomplete, the tool returns the error: Row
{line}needs both a source and a destination. - Source URL Format: The source can be a complete HTTP or HTTPS URL, or a path beginning with
/. If the source is invalid, you will see the error: Row{line}has an invalid source. Use an HTTP(S) URL or a path beginning with /. Note that source hostnames are automatically removed from the input during processing. - Destination URL Format: The destination can be a complete HTTP or HTTPS URL, or a root-relative path. An invalid destination triggers the error: Row
{line}has an invalid destination. Use an HTTP(S) URL or a path beginning with /. - Size and Mapping Limits: The CSV file must be under 5 MB. If the file exceeds this size, the tool displays: This CSV is too large. Choose a file under
{max}. Additionally, the tool accepts up to 2,000 mappings. If you exceed this limit, you will see the error: This tool accepts up to{max}mappings at a time. - URL Length Limit: A URL on any row cannot exceed 2,048 characters. If a URL is too long, the tool displays: A URL on row
{line}is longer than 2,048 characters. - No Duplicate Sources: Each source path can only appear once in your file. If a source is repeated, the tool returns: Row
{line}repeats the source path{source}. Each source can appear once.
Understanding Redirect Status Codes
When configuring your redirect rules, you must select an appropriate HTTP status code based on the nature of your URL changes:
- 301 Permanent: Choose this option if you are permanently moving your content to a new location. This is the standard choice for website migrations or permanent URL restructures, helping search engines update their indexes.
- 302 Temporary: Choose this option if the redirect is only temporary. This tells search engines and browsers to keep the original URL indexed because the redirect will eventually be removed.
Supported Web Environments
The Redirect Rule Generator supports three distinct web hosting and server environments, tailoring the output syntax to match their specific configuration requirements:
Apache
When you select Apache, the tool generates configuration rules suitable for your .htaccess or server configuration files. The output is anchored to the exact source path to ensure exact-match behavior.
Nginx
For Nginx servers, the tool generates precise location blocks or rewrite rules. Like the Apache output, Nginx rules are anchored to the exact source path to prevent unintended partial matches.
Vercel
When generating rules for Vercel, the tool outputs configuration code where Vercel receives the literal path. Vercel's native permanent switch produces a 308 redirect, and its temporary switch produces a 307 redirect. To ensure your chosen 301 or 302 status code is strictly maintained, the generated Vercel output explicitly uses the statusCode property.
Exact Match Rules and Edge Cases
The generator enforces strict validation rules to ensure that your redirects behave predictably and do not cause server errors:
- Exact Matches Only: All generated redirects are exact matches. Nginx and Apache configurations are anchored to the exact source path, and Vercel receives the same literal path.
- No Query Strings or Fragments: Source query strings and fragments are rejected. If your source URL contains these elements, the tool displays: Row
{line}includes a query string or fragment in the source. Use only the source path. - No Wildcards or Patterns: Wildcard-style patterns or route-pattern characters are not allowed in the source. If these characters are detected, the tool displays: Row
{line}uses wildcard or route-pattern characters. This generator accepts exact source paths only.
Privacy and Data Processing
Your privacy is fully respected when using this tool. Your CSV file and the generated redirect rules stay entirely in your browser. Nothing is uploaded to BroBroGo.
Frequently Asked Questions
How should I format the CSV file?
Use a header row with source and target columns. Destination also works in place of target. Each following row can use a complete HTTP or HTTPS source URL or a path beginning with /, plus a complete or root-relative destination.
Are the generated redirects exact matches?
Yes. Nginx and Apache output is anchored to the exact source path, and Vercel receives the same literal path. A source hostname is removed; source query strings, fragments and wildcard-style patterns are rejected because the three environments handle them differently.
Why does the Vercel output use statusCode?
Vercel’s permanent switch produces 308 and its temporary switch produces 307. statusCode is used so your choice stays exactly 301 or 302. Standard Vercel deployments allow 2,048 total routes, so this tool accepts up to 2,000 mappings.