AI SEOAI OS
Free · No sign-up · Instant results

.htaccess Redirect Generator

Generate Apache .htaccess rules for HTTPS, www/non-www, trailing slashes and 301 page redirects.

Pick the redirects you need and get ready-to-paste .htaccess rules, in the right order, using mod_rewrite. Everything is generated in your browser.

Preferred host

Trailing slash

Page redirects

Paths are matched with or without a trailing slash. Include “?id=12” in the old path to match a query string.

Your .htaccess rules


        

Back up your current .htaccess, paste these near the top (above any WordPress block), then test each redirect.

What this tool checks

Force HTTPS
Permanently redirect http:// to https://.
www or non-www
Pick one preferred host and redirect the other to it.
Trailing slashes
Add or remove the trailing slash consistently.
Page redirects
301 or 302 redirects from old paths (including query strings) to new URLs.

Frequently asked questions

In your site’s root folder (usually public_html). It works on Apache and LiteSpeed servers, not Nginx.
301 for permanent moves — search engines transfer signals to the new URL. 302 only for genuinely temporary moves.
Back up your current .htaccess first, add the rules near the top, and test the redirects. If WordPress rules exist, put these above them.
Yes — the generator outputs host and HTTPS rules first so each URL redirects in a single hop where possible.

Want every page of your site checked automatically?

Start a Free Audit