Instantly generate .htaccess redirect rules for Apache servers — free, no login required. Supports 301, 302, 303 & 307 redirects.
Your code will appear here
This free .htaccess redirect generator creates ready-to-paste Apache
redirect rules in seconds. Whether you're migrating a domain, restructuring
URLs, or fixing broken links, just enter your old and new URL, choose a
redirect type, and copy the output directly into your .htaccess file.
No account needed, no limits, works instantly.
A .htaccess file (short for Hypertext Access) is a
server configuration file used by Apache web servers. Placed in your site's
root directory, it controls how the server handles incoming requests —
including URL redirects, password protection, custom error pages, and more.
Most shared hosting providers (Hostinger, Bluehost, SiteGround, GoDaddy)
and popular CMS platforms like WordPress, Joomla, and Magento run on
Apache, making .htaccess the go-to method for managing redirects
without touching server configuration files directly.
/old-page.html or /blog/2020/post).
/new-page or a full URL like
https://example.com/new-page).
Choosing the wrong redirect type is one of the most common SEO mistakes. Here's exactly when to use each one:
| Code | Name | When to Use | Passes SEO Value? |
|---|---|---|---|
| 301 | Permanent Redirect | Page moved forever, domain migration, URL restructuring | Yes — full link equity transferred |
| 302 | Temporary Redirect | Site maintenance, A/B testing, seasonal pages | No — original URL keeps its value |
| 303 | See Other | After a form submission (POST → GET redirect) | No |
| 307 | Temporary (Strict) | Temporary redirect that must preserve the HTTP method | No |
Default recommendation: Use 301 in almost every real-world scenario. It tells Google to permanently update its index and passes the full ranking power (link equity) of the old page to the new one.
Moving from old-domain.com to new-domain.com?
Add 301 redirects for every URL so Google transfers your rankings to
the new domain. Without redirects, your new site starts from zero.
If your site moved to SSL but users still land on http://
URLs, a redirect forces all traffic to the secure version. This also
prevents duplicate content issues between the two versions.
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
Google treats www.example.com and example.com
as two different sites. Pick one version and redirect the other to it
to consolidate all your traffic and SEO authority.
Redesigning your site and changing URL structure? Redirect every old URL to its new equivalent. This preserves inbound backlinks and prevents visitors hitting 404 error pages.
Old sites often had /index.html in URLs. Redirect these
to the clean version (/) to remove duplication.
No. A properly implemented 301 redirect passes nearly all of the original page's ranking power to the new URL. Google officially recommends 301 redirects for permanent page moves. Your rankings typically transfer within a few weeks.
Connect via FTP (using FileZilla) or use the File Manager in cPanel.
The file is in your site's root directory (usually public_html).
It may be hidden — enable "show hidden files" in your FTP client.
If no .htaccess file exists, create a plain text file named
.htaccess (with no file extension).
Yes. You can have as many redirect rules as you need in a single .htaccess file. Just add each rule on a new line. For large sites with hundreds of redirects, consider a database-driven redirect plugin (like Redirection for WordPress) which handles large volumes more efficiently.
Redirect (from mod_alias) is simpler and good for
basic page-to-page redirects. RewriteRule (from
mod_rewrite) is more powerful — it supports pattern matching,
conditions, and query string handling. For most use cases,
Redirect 301 /old /new is sufficient. Use
RewriteRule when you need conditional logic or regex matching.
Google typically processes 301 redirects within a few days to a few weeks, depending on how frequently it crawls your site. You can speed this up by submitting your updated sitemap in Google Search Console and using the URL Inspection tool to request indexing of the new page.
A small number of redirects has negligible impact on speed. However, large .htaccess files with hundreds of rules can add processing overhead. For sites with 100+ redirects, a database-driven solution is faster and easier to manage.
First, confirm mod_rewrite is enabled on your server (ask your host if unsure). Check for syntax errors — even a single typo breaks the file. Make sure the rule isn't conflicting with WordPress or CMS rules below it. Clear your browser cache and test in an incognito window, or use an HTTP header checker to see the raw redirect response.