Home› Generators› .htaccess Redirect Generator
.htaccess Redirect Generator
Apache redirect, HTTPS, WWW and caching rules.
About the .htaccess Redirect Generator
Apache rules are unforgiving: one mistyped line returns a 500 for the entire site rather than for the rule that is wrong. This writes the common blocks — permanent redirects, HTTPS forcing, WWW normalisation, compression, caching, hotlink protection and security headers — in the correct order and syntax.
Order matters. Redirect rules should resolve before anything that rewrites paths internally, and your rules should sit above any block a CMS manages between its own BEGIN and END markers, or the next update will overwrite them.
Download the existing file before you replace it and keep an FTP or file-manager window open while you test. If the site returns a 500, the fastest fix is to put the old file back, not to debug live. Hostinger's file manager makes this quick, which is the only reason editing .htaccess directly is a reasonable thing to do at all.
Common questions
What happens if I make a typo in the rules?
Apache returns a 500 error for the entire site, not just the broken rule. Always download your existing .htaccess before replacing it so you can revert instantly.
Where should these rules sit relative to WordPress's own block?
Above it. WordPress and similar systems manage their own section between BEGIN and END markers and will overwrite anything placed inside it during updates.
Will forcing HTTPS break my site if I don't have SSL yet?
Yes — it will redirect every visitor to a broken https:// connection. Only enable that block after your SSL certificate is confirmed active in hPanel.