✉️ hello@wpfoss.ke 📞 +254 709 384 200
Free · No signup · Runs in your browser

Free .htaccess generator

Tick what you need and get a ready-to-paste .htaccess file: https and www redirects, moved pages, a custom 404 page, compression, caching and WordPress security. Every option says in plain words what it does and what to watch out for.

Before you paste: download a copy of your current .htaccess first. One wrong line can show a 500 error, and putting the old file back fixes it at once. This only works on Apache and LiteSpeed hosting, not Nginx. Nothing you tick or type here is sent anywhere: it never leaves your browser.

Your .htaccess

Updates as you tick. Copy it, or download it as a file.

    
                    

    Paste it into the .htaccess file in your site's main folder, above any line that says BEGIN WordPress. Then open your site in a private window to check it still loads.

    Get help with your site

    Want us to fix this for you?

    Tell us what the tool found and we will tell you what it takes to fix it. The first call is free.

    Get tips like these by email

    Practical advice on getting found, getting faster and getting more enquiries, plus news and offers about WPfoss products. No more than once a fortnight, and one click to leave.

    Optional. You do not need to sign up to see your results.

    Want us to fix this for you? The first call is free.

    What is in the file, and in what order

    The generator writes the lines in the order servers need them: folder and error settings first, then the https and www redirect (in a single hop, so visitors are not sent round twice), then your moved pages, then protection, compression and caching, and the WordPress block last.

    • One redirect, not two. If you pick both https and www, one rule does both, which is faster for visitors and cleaner for Google.
    • 301 means permanent. Every redirect here is a 301, so Google moves the old address's ranking to the new one. Check the result with our redirect checker.
    • Safe wrapping. Compression, caching and headers sit inside "if this module exists" blocks, so a host that lacks one skips the lines instead of crashing.

    After you paste it, check your certificate with our SSL checker and your headers with our security headers checker.

    Questions people ask

    What is an .htaccess file?

    A small settings file that sits in your website's main folder and tells the Apache or LiteSpeed web server how to behave: where to send visitors, which pages to protect, and how long browsers may keep files. Most shared hosting in Kenya, and most WordPress sites, use one.

    Where do I put the code?

    In a file called .htaccess (with the dot, and no .txt on the end) in your site's main folder, usually public_html. Open it in your hosting file manager, or over FTP. If one already exists, download a copy first, then paste the new lines above the line that says BEGIN WordPress.

    My site shows a 500 error after I pasted it. What now?

    A 500 error means the server did not like a line. Put your backup back, or delete what you pasted, and the site returns at once. Then add the options one at a time to find the one your host does not allow.

    Will it work on Nginx or Cloudflare?

    No. .htaccess is read by Apache and LiteSpeed only. Nginx uses its own configuration file, and a site served only by Cloudflare uses redirect rules in its dashboard. If your host says Nginx, the same ideas apply but the lines are different.

    Does the generator send my data anywhere?

    No. It runs in your browser, and nothing you type, including your redirect list, is sent to us or to anyone else.

    Contact Us on WhatsApp