Sign up free

301 Redirect Generator

List old and new URLs, choose 301 or 302, and copy the redirect rules for your server.

About 301 Redirect Generator

Redirects keep visitors and search rankings when URLs change: after a redesign, a move to HTTPS, a switch between www and the bare domain, or when old product pages are merged. Type or paste the old and new addresses, one pair per line with a space between them, then choose 301 for a permanent move or 302 for a temporary one. Before you force HTTPS, make sure the certificate is valid with the SSL Certificate Checker.

The rules come in six forms: Apache .htaccess (Redirect or RewriteRule), Nginx, IIS web.config, PHP header(), an HTML meta refresh and JavaScript. Site-wide rules force HTTPS, send www to the bare domain, or the bare domain to www. Use a server rule whenever you can, and keep meta refresh and JavaScript for hosts where you can't touch the configuration: those two go on the old page itself, so they use the first pair. After uploading, follow each hop with the Redirect Checker. The code is generated in your browser, so your URL lists aren't uploaded.

How to use 301 Redirect Generator

  1. 1
    Enter old and new URLs

    Put one redirect per line, the old address first and the new one after a space.

  2. 2
    Choose 301 or 302

    301 for pages that have moved for good, 302 for a temporary change.

  3. 3
    Copy the code for your server

    Take the Apache, Nginx, IIS, PHP, meta refresh or JavaScript version, and add HTTPS or www rules if needed.

  4. 4
    Test the redirects

    Upload the rules and check each old URL with the Redirect Checker.

Why use Cubfile for this

  • Six outputs

    Apache .htaccess, Nginx, IIS web.config, PHP, HTML meta refresh and JavaScript.

  • Bulk lists

    Paste a whole list of old and new pairs at once, one pair per line.

  • Site-wide rules

    Force HTTPS, redirect www to non-www, or non-www to www.

  • Runs locally

    Your URL lists stay in your browser. Nothing is uploaded and there's no limit.

FAQ

301 Redirect Generator: questions and answers

Should I use a 301 or a 302 redirect?
Use 301 when the old URL is gone for good, so search engines pass its ranking signals to the new address and drop the old one. Use 302 for a short-term change, such as a seasonal page or maintenance. Update your sitemap to list the new addresses too, for example with the XML Sitemap Generator.
Where do .htaccess redirect rules go?
In the .htaccess file in the root folder of a site on Apache. RewriteRule lines need mod_rewrite, which most shared hosts have switched on.
How do I add the Nginx rules?
Put them inside the server block for your site, test the configuration with nginx -t and reload Nginx. Nginx doesn't read .htaccess files.
Are meta refresh and JavaScript redirects bad for SEO?
They work, but a server-side 301 is the clearest signal for search engines. Use them only when you can't change the server configuration, for example on some hosted site builders.
How do I check that my redirects work?
Run the old URLs through the Redirect Checker. It follows every hop, flags loops and warns when a 302 is used where a 301 is expected.
Share 301 Redirect Generator with a friendIt runs in any browser, and they can try it without signing up.

Related tools

XML XML Sitemap GeneratorCrawl your site or paste a list of URLs to build an XML sitemap.
HTML Meta Tag GeneratorWrite title, description and robots tags with live length checks and a preview.
TXT Robots.txt GeneratorCreate a robots.txt with presets for search engines and AI crawlers.
JSON Schema Markup GeneratorGenerate JSON-LD for FAQ, articles, products, organizations and more.
HTML Open Graph GeneratorMake Open Graph and Twitter Card tags and preview the share card.
URL UTM Link BuilderAdd UTM tags to links so you can track campaigns in analytics.
HTML Hreflang Tag GeneratorBuild hreflang tags for every language version of a page.
CONF Htpasswd GeneratorCreate .htpasswd lines for Apache and Nginx basic authentication.