100% Client-Side Privacy: Zero files or data uploaded.
100% Private Browser Execution

Apache .htaccess & Nginx 301 Redirect Rule Generator

100% FreeNo Sign-UpNo Upload — Runs In Your Browser

Generate 301 redirect rules for HTTPS enforcement, www vs non-www, single pages, and domain migrations for Apache and Nginx.

Quick Answer

This tool generates 301 redirect rules for common jobs like forcing HTTPS, choosing www or non-www, and moving pages or whole domains, in both Apache .htaccess and Nginx syntax. Pick your server and scenario, enter the old and new addresses, and copy the generated code into your server configuration. Free, with everything generated in your browser.

  1. Pick a server (Apache or Nginx) and a common job (forcing HTTPS, www or non-www, moving pages)
  2. Copy the generated code for your server
  3. Paste it into your server configuration

Redirect Configuration

Generated Server Rules

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
        
Paste these directives into your server root configuration file for instant SEO-friendly 301 permanent redirection.

How to Use Apache .htaccess & Nginx 301 Redirect Rule Generator

Follow these 3 simple steps to process your files securely in seconds.

1

Choose Server Type

Select Apache (.htaccess) or Nginx (nginx.conf).

2

Select Redirect Rule

Pick Force HTTPS, www redirection, or single page 301.

3

Copy Configuration

Copy generated syntax directly into your server configuration.

Why Choose Toolenix Client-Side Tools?

Engineered for US & UK professionals who value maximum data privacy, speed, and zero cloud footprints.

Apache & Nginx Support

Generates syntax for both popular web server engines.

HTTPS Force Rules

Standardizes SSL encryption redirects for SEO.

One-Click Copy

Instant copy-pasteable configuration code.

Developer & Utility Guide

In-Depth Guide to Apache .htaccess & Nginx 301 Redirect Rule Generator

A 301 redirect tells browsers and search engines that a page has moved permanently, and passes most of its ranking power to the new address. Getting the rule wrong means visitors land on a 404 and search engines keep indexing a dead page. This tool generates the 301 rule for the common jobs — forcing HTTPS, choosing www or non-www, moving a single page, or migrating a whole domain — in both Apache .htaccess syntax and Nginx configuration, from the same inputs.

A generator, not a converter

This tool builds redirect rules from the job you pick and the old and new addresses you type in. It does not parse an existing .htaccess file and translate arbitrary RewriteRule and RewriteCond directives into Nginx syntax — that is a different, much harder job, and pasted .htaccess rules cannot be converted here. Pick the server (Apache or Nginx), pick the scenario, enter the addresses, and copy the generated snippet for that server.

Where the generated code goes

  • Apache: paste the generated rules into the .htaccess file in your site's root public directory (usually public_html). Rules are read top to bottom, so specific redirects go above general ones.
  • Nginx: there is no .htaccess. Place the return 301 or rewrite directive inside the server block for the site in your nginx.conf or site config file, then test with nginx -t and reload — a syntax error in Nginx takes the whole site down, so always test before reloading.

Getting redirects right

Use 301 (permanent) only when the move really is permanent — a 302 (temporary) tells search engines to keep the old URL indexed. Redirect to the closest matching page, not always to the homepage: a mass redirect to home looks like a soft 404 to Google. And test every rule after deploying it — a redirect loop (A points to B, B points to A) is worse than no redirect at all, and it is the most common mistake in a migration.

Frequently Asked Questions

Everything you need to know about using this free online tool.

What is a 301 redirect?
A 301 redirect is a permanent redirection status code that passes 99% of link equity (ranking power) to the new destination URL.
Where do I put .htaccess rules?
Place .htaccess in the root public directory (public_html) of your Apache web server.
Where do I put Nginx redirect rules?
Inside the server block for the site in your Nginx configuration, as a return 301 or rewrite directive. There is no .htaccess in Nginx. Always run nginx -t to test the configuration before reloading — a syntax error takes the whole site down.
Can I paste my .htaccess file to convert it to Nginx?
No. This tool generates preset redirect rules for both servers from the job you pick — it does not parse arbitrary .htaccess RewriteRule directives and translate them into Nginx syntax.