301 Redirect Generator for .htaccess, Nginx and _redirects
A free tool by DeepRit, a Google Ads agency that does PPC and nothing else. We build and run Google Ads accounts so every click is accounted for. Book a free audit call
Free 301 redirect generator. Turn a list of old and new addresses into redirect rules for Apache .htaccess, Nginx, Netlify or Cloudflare Pages.
Free, no sign-up. Runs in your browser: nothing you type is uploaded or saved.
How to use the 301 redirect generator
Write one redirect per line: the old address first, then a space, then the new address. For example:
/old-menu /menu/
/about-us.html /about/
https://example.com/blog/2019-offer https://example.com/offers/
Choose your server (Apache, Nginx, or Netlify and Cloudflare Pages) and the type of redirect (301 permanent or 302 temporary). The 301 redirect generator turns your list into the correct rules for that server, ready to copy. It accepts old addresses written as paths or as full URLs, and turns full URLs into paths automatically.
It also catches mistakes: lines without a new address, old addresses that don't start with a slash, and redirects that point to themselves, which would cause an endless loop.
It all happens in your browser; nothing is uploaded.
What a 301 redirect is
A redirect sends visitors and search engines from one address to another automatically. The number is the HTTP status code that tells browsers and search engines what kind of redirect it is:
- 301 Moved Permanently: the page has moved for good. Search engines transfer the old address's ranking signals to the new one over time and replace the old address in their results.
- 302 Found (temporary): the page is temporarily somewhere else and will come back. Search engines keep the old address in their index.
Google has said it passes ranking signals through both permanent and temporary redirects, but it treats a long-lasting 302 as a 301 eventually. Still, using the right type makes your intention clear: use 301 for permanent moves, which is almost every SEO case.
When you need redirects
- You changed a page's address, for example to a cleaner slug made with the slug generator.
- You moved to a new website platform that uses a different URL structure.
- You merged two pages into one stronger page.
- You deleted a product or service and there's a close replacement.
- You moved from HTTP to HTTPS, or from
wwwto non-www(usually set up once, site-wide). - You changed your domain name.
Without redirects, old links from other sites, bookmarks, social posts, emails and search results all lead to "page not found" errors. You lose visitors, and the ranking value those links built up.
The rules for each server
Apache (.htaccess)
Redirect 301 /old-menu /menu/
This uses Apache's mod_alias module, available on almost every Apache host. Add the lines to the .htaccess file in your site's root folder. Note that Redirect matches the start of the path and carries the rest across: Redirect 301 /blog /news also sends /blog/post-1 to /news/post-1. For exact matches only, or patterns, Apache's RedirectMatch or mod_rewrite rules are needed; ask your developer or host if you need those.
Nginx
location = /old-menu { return 301 /menu/; }
The = means an exact match, so only that address is redirected. Add these inside the server block of your site's configuration, then reload Nginx. Most managed hosts that use Nginx let you add redirects in their control panel instead.
Netlify and Cloudflare Pages (_redirects)
/old-menu /menu/ 301
Both platforms read a plain text file named _redirects in the root of the published site. Each line is the old path, the new address and the status code.
Other platforms
- WordPress: a plugin such as Redirection lets you add redirects in the dashboard, without editing files.
- Shopify: Online Store, then Navigation, then URL Redirects. Shopify can also create redirects automatically when you change a product's handle.
- Squarespace: Settings, then Developer Tools, then URL Mappings, using a format like
/old-menu -> /menu/ 301. - Wix: the URL Redirect Manager in the SEO settings.
- Webflow: Site settings, then Publishing, then 301 Redirects.
For these, use the old and new addresses from your list directly in the platform's redirect screen.
Redirect best practices
Redirect to the most relevant page
Send each old page to its closest equivalent: the old seeded rye page to the new seeded rye page, not to the home page. Google treats mass redirects to the home page much like a "page not found" (a soft 404), so the ranking value isn't passed on.
Avoid redirect chains
A chain is A redirecting to B, which redirects to C. Each extra hop slows the page and risks losing signals; Google follows a limited number of hops. When you add new redirects, update old ones to point straight to the final address.
Avoid loops
A loop is a page that redirects to itself, directly or through other pages. Browsers show a "too many redirects" error. The generator flags a line where the old and new address are the same; check longer loops by testing.
Update your internal links
Redirects are a safety net. Update links in your own menus, pages and sitemap to point to the new addresses directly. The XML sitemap generator helps you rebuild your sitemap with the new addresses.
Keep redirects in place
Keep 301 redirects for at least a year, and ideally permanently. Links on other sites and in old emails don't disappear.
Testing redirects
- Visit each old address in a private browser window and check you land on the right new page.
- Use a redirect checker or your browser's developer tools (Network tab) to confirm the status code is 301, not 302, and that there's only one hop.
- In Google Search Console, use URL Inspection on the new address, and watch the Pages report for "Page with redirect" on old addresses, which is expected.
- Check for 404 errors in Search Console over the following weeks and add redirects for any old addresses you missed.
Planning a site move
For a bigger change, such as a redesign or a new platform:
- Export all your current URLs (from your sitemap, analytics or a crawler).
- Map each old address to its new address in a spreadsheet.
- Paste the two columns into the 301 redirect generator (one pair per line).
- Add the rules before the new site goes live.
- Test the most important pages first: those with the most visits and links.
The text compare tool can compare old and new URL lists to spot pages you forgot, and remove duplicate lines cleans up a merged list.
A worked example
A bakery is moving from an old website builder to a new one. On the old site, the menu lived at /menu.html, the catering page at /services/catering.html, and a 2019 Christmas offer at /xmas-2019. On the new site they become /menu/, /catering/ and the current /offers/ page.
The owner pastes three lines into the 301 redirect generator, chooses Apache, and gets:
Redirect 301 /menu.html /menu/
Redirect 301 /services/catering.html /catering/
Redirect 301 /xmas-2019 /offers/
After adding them to .htaccess and testing each old address, links in old emails, Google results and a local newspaper article all still reach the right pages. Moving to Netlify later, the same list run through the 301 redirect generator with "Netlify or Cloudflare Pages" selected gives the _redirects version in seconds.
Redirects and multilingual sites
If you're restructuring language versions, update your hreflang tags at the same time, so they point to the new addresses rather than redirecting ones. The hreflang tag generator creates the new set.
Search ads for the searches that matter now
Good markup helps your pages rank over time. Google Ads puts the same pages in front of buyers today. DeepRit is a Google Ads agency that does PPC and nothing else: we build the campaigns, block the searches that waste money, write the ads, set up conversion tracking and send you a short report every week. Request a free PPC audit and we will show you, in dollars, what we would fix first.
Frequently asked questions
What's the difference between a 301 and a 302 redirect?
A 301 means the page has moved permanently; a 302 means the move is temporary. Use 301 for almost all SEO changes, such as new URLs, merged pages and domain moves.
Do 301 redirects lose SEO value?
Google has said 301 redirects don't lose ranking signals. Redirecting to a closely related page, without chains, is the best way to keep the value of old links.
Where do I put .htaccess redirects?
In the .htaccess file in your website's root folder on an Apache server. If the file doesn't exist, create it. Keep a backup before editing, because a typo can take the site offline.
Can I redirect a whole folder?
Yes. On Apache, Redirect 301 /blog /news also redirects every page inside /blog to the same path inside /news. Test a few pages afterwards.
How long should I keep redirects?
At least a year, and ideally for good, because old links on other sites and in emails keep being used.
Is the 301 redirect generator free?
Yes. It's free, needs no sign-up, and runs entirely in your browser.
Free PPC audit
See where your ad budget leaks.
We look at your Google Ads account before the call, then walk you through what we'd fix first, in dollars. No obligation, no hard sell.