Web / Redirects
Redirect Generator (.htaccess and nginx)
Turn a list of old and new addresses into 301 redirect rules for Apache .htaccess or nginx, with exact matching, query-string matches, and optional https and www rules.
Redirect Generator (.htaccess and nginx): For Apache, each line becomes a mod_rewrite rule anchored at both ends, so /blog does not also catch /blog-old, with characters such as dots escaped and the % and $ signs in the new address protected. Old addresses with a query string get a matching condition and drop the old query. For nginx, each line becomes an exact-match location. The output was tested on Apache 2.4 and nginx with paths containing dots, spaces, query strings, and percent signs. Runs 100% locally in your browser with zero server file uploads.
- Category
- Web tools
- Runs
- In your browser
- Cost
- Free · no sign-up
- Availability
- Ready to use
Runs entirely in your browser
RewriteEngine On
# Moved pages (301)
RewriteRule ^old-page\.html$ /new-page/ [R=301,L]
RewriteRule ^blog$ https://example.com/news [R=301,L]
RewriteCond %{QUERY_STRING} ^id=42$
RewriteRule ^shop$ /products/42 [R=301,L,QSD]
Put the rules near the top of the .htaccess file in your site's root; mod_rewrite must be enabled. Old paths match exactly, and any query string on a visit is passed on unless the rule matches one.
Planning a site move
List every old URL that has traffic or links, from analytics and search console, and point each to its closest new page rather than the home page. Avoid chains: redirect straight to the final address. Keep redirects in place for at least a year.
Check the results with the redirect checker, and look for broken pages with the HTTP status checker.
Order matters
Apache applies rewrite rules from top to bottom and stops at the first match marked L, so put specific redirects before general ones such as https or www rules if they should run first; nginx picks exact-match locations before prefix locations.
How to use it
- Write one redirect per line: the old address, a space, and the new address.
- Choose Apache or nginx and the redirect type, usually 301.
- Copy the rules into your .htaccess file or nginx server block, then test them with the redirect checker.
Privacy & limitations
The rules are built in your browser.
Related tools
Frequently asked questions
301 or 302?
Use 301 (or 308) for pages that have moved for good, so search engines transfer the old page's standing to the new one; use 302 (or 307) for temporary moves.
Why not use Redirect /old /new?
Apache's Redirect matches the start of the path, so it also redirects /old-page and /old/anything; the rules here match exactly.
Where do I test the redirects?
After uploading, check each old address with the redirect checker to see the status code and where it ends up.
Free tool · runs in your browser · no account required