Prices dated and sourced
SVStackVerdictLab

Software Guides, Comparisons and Verdicts

Free Online ToolSEO & Marketing Tools
100% Client-Side • Zero Server Uploads

301 Redirect Generator: Apache .htaccess, Nginx, Next.js & Cloudflare

Generate clean 301 permanent and 302 temporary redirect rules for Apache .htaccess, Nginx, Next.js, and Cloudflare.

Reviewed by StackVerdictLab Editorial & Engineering•Updated: •Private • No Sign-Up

301 & 302 Redirect Rule Generator

Preserve SEO link equity during domain migrations, slug updates, and content restructuring.

NEXTJS Configuration
// Place in next.config.ts / next.config.js inside redirects()
async redirects() {
  return [
    {
      source: '/blog/old-article-title',
      destination: 'https://example.com/guides/new-article-title',
      permanent: true,
    },
  ];
}

What this tool does and who it is for

This tool writes the code for a single redirect. Enter an old path and a new destination URL, choose a status code of 301, 302, 307 or 308, and pick a format: Next.js redirects(), Apache .htaccess, an Nginx location block or a Cloudflare forwarding rule note.

The output is one rule for one URL. For the Apache option it is a Redirect line, and for Nginx it is an exact-match location block that returns your chosen code and URL.

Redirects tell browsers and search engines that a page moved. Add them whenever you change a slug, merge pages or move domains, and test every rule after you deploy.

Official Formula / Technical Standard

Apache Rule = Redirect 301 /old-path https://domain.com/new-path.

Real-World Worked Scenario

Redirecting /blog/seo-tips to /guides/seo-tips passes ranking signals within 48-72 hours.

When people use it

Changing a blog slug

Redirect the old post URL to the new one so existing links and bookmarks still work.

Merging thin pages

Send several weak pages to one stronger guide with a 301 each.

Moving from HTTP or an old domain

Use the rule format your host supports to move individual URLs to the new address.

Notes for US users

  • A 301 is the usual choice for a permanent move and Google treats it as a strong signal to pass the old URL's signals to the new one. Use a temporary code only if you plan to restore the old URL.
  • Send each old URL to its closest equivalent. Redirecting many pages to the homepage can be treated as a soft 404 by Google.
  • Many US hosts, such as shared cPanel plans, run Apache, so .htaccess is common. Managed platforms like Vercel and Netlify use their own config, so use that one instead.

Limits and what to double-check

  • •It handles one exact path at a time. There are no wildcard, regex or bulk options, so a large migration needs a script or a spreadsheet-driven process.
  • •The Cloudflare output is instructions for a Page Rule with a placeholder domain, not code you can import, and it covers only 301 and 302 labels.
  • •Nothing is checked. A path typed without a leading slash, or a loop between two rules, will not be caught, so test the real URLs.

Expert Best Practices & Common Pitfalls

Recommended Best Practices

  • •Avoid redirect chains (A → B → C). Always redirect directly from A to C.

Common Mistakes to Avoid

  • •Using temporary 302 redirects during permanent migrations, which prevents PageRank transfer.

Step-by-Step Instructions

1

Enter Old Path

Type the source URL path you are deprecating.

2

Enter New Destination

Type the target canonical destination URL.

3

Select Server & Status

Choose Apache, Nginx, or Next.js and copy the rule.

Features & Security Architecture

  • Multi-Server Output: Apache .htaccess, Nginx server block, Next.js async redirects(), Cloudflare
  • Status Code Options: 301 (Permanent), 302 (Temporary), 307 (Method Preserved), 308 (Permanent Method Preserved)
  • Passes Full PageRank: Follows Google standards for 100% link equity transfer
  • Instant Syntax Highlighting: Clean one-click copy

Frequently Asked Questions

Does a 301 redirect hurt SEO rankings?▼

No. Google confirms that 301 redirects pass 100% PageRank link equity without ranking loss.

How long should I keep a 301 redirect?▼

Google has suggested keeping redirects in place for at least a year, and longer if you can, since old links and bookmarks keep sending traffic. If you remove one too soon, visitors and signals hit a 404. In practice, leave them indefinitely.

What is the difference between 301 and 308?▼

Both are permanent. A 308 requires the browser to repeat the same request method, so a POST stays a POST, while older 301 handling may change it to GET. For ordinary page moves on the web, 301 is the familiar choice and works fine.

Should I redirect or use a canonical tag?▼

Use a redirect when the old URL should stop being used, so visitors land on the new page. Use a canonical when both URLs must remain available but one is preferred for search. A redirect is stronger and also changes what users see.

Why does my redirect loop?▼

Usually two rules point at each other, or a rule runs again after the new URL matches the same pattern, as with HTTP to HTTPS plus a www rule. Trace the chain with a browser's network tab or a header checker, then remove the conflicting rule.

Sources and further reading

Full Suite Explorer

All 21 SEO & Marketing Tools

Category Directory
Meta Tag Generator
Free meta tag generator that runs in your browser. No sign-up, no install.
Open Graph Preview
Free open graph preview that runs in your browser. No sign-up, no install.
SERP Snippet Preview
Free serp snippet preview that runs in your browser. No sign-up, no install.
Schema Markup Generator
Free schema markup generator that runs in your browser. No sign-up, no install.
Robots.txt Generator
Free robots.txt generator that runs in your browser. No sign-up, no install.
XML Sitemap Generator
Free xml sitemap generator that runs in your browser. No sign-up, no install.
UTM Builder
Free utm builder that runs in your browser. No sign-up, no install.
Keyword Density Checker
Free keyword density checker that runs in your browser. No sign-up, no install.
Heading Analyzer
Free heading analyzer that runs in your browser. No sign-up, no install.
Blog Title Generator
Turn a keyword, audience and year into varied headline formulas you can edit.
Blog Outline Generator
Build a section-by-section outline from your topic and search intent that you can adapt.
FTC Affiliate Disclosure Generator
Free ftc affiliate disclosure generator that runs in your browser. No sign-up, no install.
Privacy Policy Template Generator
Free privacy policy template generator that runs in your browser. No sign-up, no install.
Readability Score Checker
Free readability score checker that runs in your browser. No sign-up, no install.
Affiliate Link Cloaker Generator
Free affiliate link cloaker generator that runs in your browser. No sign-up, no install.
LLMs.txt Generator
Create standardized /llms.txt and /llms-full.txt files to help Anthropic Claude, OpenAI, and Perplexity index your website.
Hreflang Tag Generator
Generate reciprocal hreflang alternate tags for multi-language and international domains to prevent duplicate content penalties.
301 Redirect Rule Generator
● You are here
Canonical Tag Generator
Generate clean rel='canonical' HTML tags to eliminate duplicate content penalties from tracking query parameters and trailing slashes.
Google Disavow File Builder
Format toxic backlink exports into clean, de-duplicated Google Search Console disavow files with domain-level directives.
Organic Search ROI Calculator
Calculate projected organic traffic, new customer conversions, and annual revenue gains from ranking improvements on Google.