Free tool · no sign-up

301 redirect generator for .htaccess and nginx

Force HTTPS, pick one version of your domain, and redirect old addresses to new ones, with code to copy.

Try:

When you need a redirect

Use a 301 redirect whenever a page moves for good: a changed address, a merged page, a site move or a switch to HTTPS. It sends visitors and search engines to the new address and passes on most of the old page’s ranking signals.

Redirecting the whole site to one version, HTTPS with or without www, also stops search engines treating several copies of your site as duplicates.

Apache or nginx

Apache sites, including most shared hosting, use a .htaccess file. nginx sites use the server configuration. This generator writes both so you can copy the one your host runs.

Frequently asked questions

Where do I put the .htaccess rules?

In the .htaccess file in your site’s root folder. Add them near the top, and on WordPress above the "# BEGIN WordPress" block. Keep a backup before you edit.

Should I use www or non-www?

Either works. Pick one, redirect the other to it, and keep using it in links and your sitemap.

How do I test the redirects?

Use the redirect checker to open the old addresses and confirm each one answers 301 and lands on the right page in a single step.

Read-only: we request public pages the way a visitor would. Private and internal addresses are blocked, and nothing you enter is stored.

Want this running on every page, every day?

UrKavach monitors security, uptime, speed and SEO for every website you manage.

Start 7-day free trial