Plugins Plugin hub Backup SEO Caching Security Forms WooCommerce Images Best backup plugins
Hosting Hosting directory Shared Managed Cloud Bangladesh India Best hosting in Bangladesh
Themes & builders Compare Rank Math vs Yoast
Tools All tools Hosting finder Plugin stack builder Cost calculator Salt generator Theme detector Who is hosting this? Speed test Headline analyzer robots.txt generator Redirect generator Uptime calculator Blog name generator
Deals Guides Speed up WordPress How we test

Free tool · no sign-up

htaccess redirect generator

Force HTTPS, force www or non-www, add 301s, and include the WordPress permalink block.


How to use it

Tick force HTTPS if the site should always use it. Choose www, non-www, or neither if something else already does that job. Add one redirect per line as a path and a destination. Leave the WordPress permalink block on if you are building a full file for a new Apache site.

Test one URL in a private window after you save. A redirect loop means HTTPS and www rules are fighting another plugin. Undo from the backup.

How it works

The preview is Apache syntax assembled in the browser. HTTPS checks the HTTPS variable. The www rules look at the host header. Each manual line becomes a Redirect 301. Nothing is tested against a live server from this page.

What the results mean

A 301 is a permanent move. Use it when the old URL should pass its reputation to the new one. Do not use it for a temporary campaign. HTTPS and host redirects come first so you do not redirect twice.

Tips

Map old posts before you change permalinks. After the move, run the speed test on a redirected URL and on the final URL. Chains of three hops are worth cleaning up.

Related

Pair this with the robots.txt generator and the speed guide. Rank Math’s redirect manager is discussed in Rank Math vs Yoast.

Before you act on it

Back up the current file before you paste. Test the homepage, one old URL and wp-admin after you save. A loop usually means another plugin is also forcing HTTPS or www. On Nginx hosting this preview is a list of intentions, not a file you can upload. Enter the same from-and-to pairs in the host’s redirect panel. One hop is the goal. If a URL redirects twice, remove the middle step. Pretty permalinks still need a single WordPress block, not two copies stacked at the bottom of the file. Keep a copy of the old file until search traffic has followed the new URLs for a few days.

When you are done with the tool, go to the related links on this page rather than opening a new tab full of competing lists. WPLegible keeps the directory, the written comparisons and these tools on the same scores, so a recommendation here will not disagree with the review you open next. If something on this page is wrong, email [email protected] with the URL you tried and what you expected to see.

FAQ

Will this work on Nginx?

No. These are Apache rules. Nginx needs different syntax, which many managed hosts do not let you paste in.

Where do I put the rules?

Above the WordPress block if you are editing .htaccess, or in the host’s redirect panel. Back up the file first.

Should I force www or non-www?

Pick one and redirect the other. Consistency with the canonical URL matters more than the choice.

Can I stack this with a plugin’s redirects?

One system should own a given URL. Two 301s in a chain slow the move.

What does the WordPress block do?

It sends pretty permalinks to index.php. Replace an existing block. Do not paste a second copy under it.