.htaccess Redirect Generator
Create 301 redirects for Apache servers: single pages, whole domains, HTTPS, www and bulk lists.
Back up your .htaccess file first. Paste the code near the top, after RewriteEngine On if it is already there. This works on Apache and LiteSpeed servers, not Nginx.
How to use the .htaccess Redirect Generator
- Choose a redirectPick a single page, a bulk list, a domain move, HTTPS, www or trailing slash.
- Fill in the detailsEnter the old and new paths or domains.
- Add it to .htaccessCopy the code into the .htaccess file in your site’s root folder, then test the old URLs in a private window.
Example
One page: Redirect 301 /old-page.html https://www.example.com/new-page/
Force HTTPS: RewriteCond %{HTTPS} off then RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L].
Frequently asked questions
What is the difference between 301 and 302?
A 301 is permanent: search engines move the old page’s ranking to the new URL. A 302 is temporary: the old URL stays indexed. Use 301 for almost all site moves.
Will this work on Blogger, WordPress.com or Nginx?
No. .htaccess files only work on Apache and LiteSpeed servers, such as most cPanel hosting. Blogger has its own Custom redirects in Settings, and Nginx uses a different syntax.
My site shows an error after adding the code. What now?
A 500 error means a syntax problem. Restore your backup, check that mod_rewrite is enabled, and add the rules one at a time.