Skip to main content
SlapMyWeb
Skip to tool
Security & Network

.htaccess Redirect Generator

Generate Apache .htaccess redirect rules — 301, 302, regex patterns and domain redirects

  • 100% free
  • No sign-up
  • Clear controls
  • Open and use

Quick Presets

Redirect Rules

Generated .htaccess code
RewriteEngine On

# Redirect: /old-page → /new-page
Redirect 301 /old-page /new-page
What this tool does
  • 301 permanent and 302 temporary redirects
  • Regex pattern support
  • Quick presets for HTTPS, www, trailing slash
  • Copy-ready .htaccess code
Want the whole picture? Run a free website audit for a score and prioritised issues. No signup needed to start.Run a free audit
The short version

What is .htaccess Redirect Generator?

An .htaccess redirect generator creates Apache web server redirect rules without manually writing mod_rewrite syntax.

It supports 301 (permanent), 302 (temporary) and 307 redirects, plus common presets like forcing HTTPS, managing www subdomains and removing trailing slashes.

.htaccess Redirect Generator showing a worked example — Generate Apache .htaccess redirect rules — 301, 302, regex patterns and domain redirects.
.htaccess Redirect Generator with the built-in example loaded. Free, no sign-up, and the result appears as you type.
Step by step

How to use .htaccess Redirect Generator

  1. 1

    Add redirect rules

    Enter the old path and new destination. Choose 301 for permanent or 302 for temporary redirects.

  2. 2

    Use presets

    Click a quick preset for common redirects like Force HTTPS or Remove www.

  3. 3

    Copy the code

    Click Copy to copy the generated .htaccess code to your clipboard.

  4. 4

    Paste in .htaccess

    Add the code to your .htaccess file in your website root directory.

What's inside

Everything this tool
does for you

  • 301, 302 and 307 redirect types
  • Regex pattern support for complex rules
  • 6 quick presets (HTTPS, www, trailing slash, 404, IP block)
  • Multiple rules at once
  • Clean, commented output
  • Runs in your browser generation
Understand the result

Further reading

What the terms mean
How to fix it
Questions

Frequently asked questions

Beyond this tool

See the full picture for your website.

Enter your URL for a free audit across eight scored areas. See prioritised issues and clear next steps in one report.

Run a free website audit

Free to start · No signup required