
The Htaccess Redirect Generator creates ready-to-use redirect rules for Apache servers. Choose the redirect you need, enter your URLs, and copy the generated code into your .htaccess file.
Correct redirects protect your rankings and visitors when pages move, domains change, or you switch to HTTPS.
An .htaccess file is a configuration file used by Apache web servers to control behavior such as redirects and URL rewriting. A redirect sends visitors and search engines from one URL to another.
A 301 redirect signals a permanent move and passes signals to the new address, which makes it the standard choice for SEO.
When a URL changes without a redirect, visitors see errors and search engines lose the link between the old and new pages. Proper 301 redirects preserve traffic and consolidate signals.
When a request reaches an Apache server, it reads the rules in the .htaccess file and, if a rule matches, sends the browser to the new address with the chosen status code. Rules are processed in order, so ordering matters.
A mistake in .htaccess can cause site-wide errors, so always keep a backup and test changes right away. Nginx and other servers use different configuration syntax.
| Goal | Example Rule |
|---|---|
| Redirect one page | Redirect 301 /old-page https://www.example.com/new-page |
| Force HTTPS | RewriteCond %{HTTPS} off + RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] |
| Non-www to www | RewriteCond %{HTTP_HOST} ^example\.com$ [NC] + RewriteRule ^(.*)$ https://www.example.com/$1 [L,R=301] |
Generate rules quickly for new projects.
Plan redirect maps for migrations.
Fix moved or deleted page links.
Standardize redirects across client sites.
Redirect discontinued products to relevant pages.
Enforce HTTPS and domain rules.
Single Page Redirect:
Old: /old-page | New: /new-page
Result:
Redirect 301 /old-page https://www.example.com/new-page
Force HTTPS:
Redirect all HTTP traffic to HTTPS.
Result:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
Domain Change:
Old domain to new domain.
Result:
RewriteEngine On
RewriteCond %{HTTP_HOST} ^old-example\.com$ [NC]
RewriteRule ^(.*)$ https://www.new-example.com/$1 [L,R=301]
It is a configuration file for Apache servers that controls rules such as redirects and rewrites.
A 301 is a permanent redirect, while a 302 is temporary. Use 301 for permanent URL changes.
It works on Apache and compatible servers. Nginx and other servers use different configuration files.
Properly implemented 301 redirects preserve most signals, but long chains can slow pages and waste crawl effort.
It is usually in the root directory of your website, and hidden files may need to be shown in your file manager.
Yes. The Htaccess Redirect Generator is completely free to use, with no registration required.
Typical users include Web Developers, SEO Professionals, Website Owners, Agencies, and E-commerce Managers.
The Htaccess Redirect Generator makes it simple to build correct redirect rules for Apache. Used with careful testing and sensible redirect planning, it helps you protect rankings and give visitors a smooth path to the right pages.