Htaccess Redirect Generator
Generate code for your website’s .htaccess file
Redirect Configuration
301 redirects are best for SEO when pages have permanently moved.
For a single page: /page-name
. For a directory: /directory/*
Generated Code
How to use this code:
- Copy the generated code above
- Access your .htaccess file (usually in your website’s root directory)
- Add the code to the top of the file or just below
RewriteEngine On
if it exists - Save the file and test your redirect
Fill out the form and click “Generate Redirect Code”
Common Redirect Examples
Redirect a Single Page
Source: /old-page
Destination: /new-page
Redirect Entire Directory
Source: /old-directory/
Destination: /new-directory/
Redirect to External Site
Source: /redirect-page
Destination: https://example.com/
Preserve URL Path (RewriteRule)
Source: old-blog/(.*)$
(use regex)
Destination: new-blog/$1