Free .htaccess Redirect Generator

Paste old and new URLs to generate 301 redirect rules for your .htaccess file, with optional force-HTTPS and www or non-www rules.

Runs in your browser · nothing is uploaded

Before you publish

  • Back up your current .htaccess first, and test a few URLs after uploading.

.htaccess

RewriteEngine On

# Force HTTPS
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
How it works

How to use the free .htaccess redirect generator

  1. 01

    Paste each old path and its new URL on a line.

  2. 02

    Choose permanent or temporary, and the HTTPS/www rules.

  3. 03

    Add the output to the top of your .htaccess file and test a few URLs.

Guide

Redirects when you move pages

When a URL changes, a 301 redirect sends visitors and search engines to the new address and passes on most of the old page's ranking signals. Without one, the old URL returns 404 and its links and rankings are lost.

.htaccess works on Apache servers (most shared hosting). For Nginx, Cloudflare or platforms like Shopify, use their redirect settings instead.

Tips

Tips for using the .htaccess redirect generator

Back up first

A typo in .htaccess can take a site offline. Keep a copy of the working file.

Test after uploading

Check a few old URLs with the redirect checker.

Avoid chains

If page A already redirects to B, point new redirects straight at the final URL.

Put rules at the top

Redirect rules must come before CMS rewrite rules like WordPress's.

Rankfly autopilot

Skip the manual work: get an article published to your site every day.

Rankfly finds the keywords your site can actually win, writes a full SEO article for each one, adds images, and publishes it to WordPress, Shopify, Webflow, Wix and more. Enter your website to see your free 30-day content plan.

3-day free trial · $66/month for 30 articles

FAQ

.htaccess Redirect Generator FAQ

Where is the .htaccess file?

In your site's root folder. It's hidden by default in many file managers; enable "show hidden files".

Will this work on WordPress?

Yes, on Apache hosting. Put the rules above the # BEGIN WordPress block.

Is anything uploaded?

No. Rules are generated in your browser.

What's the difference between Redirect and RewriteRule?

Redirect is simpler; RewriteRule is more flexible and works alongside CMS rules. This generator uses RewriteRule.

Does .htaccess work on Nginx?

No. Nginx uses its own configuration; ask your host or use its redirect settings.

How many redirects can .htaccess handle?

Hundreds work fine. For thousands, a server-level map or plugin is faster.

Start today

Let Rankfly do your SEO for you.

Enter your website for a free 30-day content plan: the keywords your site can win and the articles Rankfly would write and publish. About three minutes.

3-day free trial · $66/month after · Cancel anytime