Free .htaccess Redirect Generator
Paste old and new URLs to generate 301 redirect rules for your .htaccess file, with optional force-HTTPS and www or non-www rules.
Runs in your browser · nothing is uploaded
Before you publish
- Back up your current .htaccess first, and test a few URLs after uploading.
.htaccess
RewriteEngine On
# Force HTTPS
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]How to use the free .htaccess redirect generator
- 01
Paste each old path and its new URL on a line.
- 02
Choose permanent or temporary, and the HTTPS/www rules.
- 03
Add the output to the top of your .htaccess file and test a few URLs.
Redirects when you move pages
When a URL changes, a 301 redirect sends visitors and search engines to the new address and passes on most of the old page's ranking signals. Without one, the old URL returns 404 and its links and rankings are lost.
.htaccess works on Apache servers (most shared hosting). For Nginx, Cloudflare or platforms like Shopify, use their redirect settings instead.
Tips for using the .htaccess redirect generator
Back up first
A typo in .htaccess can take a site offline. Keep a copy of the working file.
Test after uploading
Check a few old URLs with the redirect checker.
Avoid chains
If page A already redirects to B, point new redirects straight at the final URL.
Put rules at the top
Redirect rules must come before CMS rewrite rules like WordPress's.
Skip the manual work: get an article published to your site every day.
Rankfly finds the keywords your site can actually win, writes a full SEO article for each one, adds images, and publishes it to WordPress, Shopify, Webflow, Wix and more. Enter your website to see your free 30-day content plan.
3-day free trial · $66/month for 30 articles
.htaccess Redirect Generator FAQ
Where is the .htaccess file?
In your site's root folder. It's hidden by default in many file managers; enable "show hidden files".
Will this work on WordPress?
Yes, on Apache hosting. Put the rules above the # BEGIN WordPress block.
Is anything uploaded?
No. Rules are generated in your browser.
What's the difference between Redirect and RewriteRule?
Redirect is simpler; RewriteRule is more flexible and works alongside CMS rules. This generator uses RewriteRule.
Does .htaccess work on Nginx?
No. Nginx uses its own configuration; ask your host or use its redirect settings.
How many redirects can .htaccess handle?
Hundreds work fine. For thousands, a server-level map or plugin is faster.
Related free SEO tools
All 87 free toolsCanonical Tag Checker
Enter a URL to check its canonical tag: whether it exists, points to itself, is the only one, and points to a working page.
Broken Link Checker
Enter a URL to test every link on the page and find the broken ones (404s and errors) and the ones that redirect.
Robots.txt Checker
Enter a URL to fetch the site's robots.txt, check it for errors, and see whether Googlebot, Bingbot and AI crawlers like GPTBot may crawl that URL.
Robots.txt Generator
Create a correct robots.txt: choose what to block, add your sitemap, and decide how to treat AI crawlers like GPTBot and ClaudeBot.
XML Sitemap Validator
Enter a sitemap URL (or just your domain) to validate its structure, URLs and lastmod dates, and check that the first pages listed actually load.
Noindex Checker
Enter a URL to find out whether Google can index it: meta robots, X-Robots-Tag header, robots.txt, status code and canonical, all in one check.
All free technical seo tools
Let Rankfly do your SEO for you.
Enter your website for a free 30-day content plan: the keywords your site can win and the articles Rankfly would write and publish. About three minutes.
3-day free trial · $66/month after · Cancel anytime