.htaccess Generator
Build HTTPS and www redirects, 301 redirects, Gzip compression, browser caching and security rules by ticking boxes with this free .htaccess generator. The rules are for Apache and LiteSpeed servers.
One redirect per line: old path, space, new address.
- Back up your current .htaccess before changing it; a faulty rule takes the site down with a 500 error.
- Blocking xmlrpc.php stops Jetpack and the WordPress mobile app from working.
These rules work on Apache and LiteSpeed servers; Nginx does not read .htaccess. Rename the downloaded file to .htaccess and upload it to the root of your site.
.htaccess Generator is built by SEOLOG and offered free for you to use.
- Completely free
- No sign-up
- What you enter stays in your browser
What does an .htaccess generator do?
.htaccess is the configuration file that sits in your site's folder on Apache and LiteSpeed servers and tells the server how to behave there. An .htaccess generator writes the rules you need most as you tick boxes: the HTTP to HTTPS redirect, a www or non-www preference, 301 redirect code, Gzip compression, browser caching, turning off directory listing, protecting sensitive files, security headers and the WordPress permalink rules.
Writing these rules by hand is error-prone; a single wrong line can take the site down with a 500 error. This htaccess file generator gives each group of rules as a separate block under its own heading, so you can see what every line does. The rules are for Apache and LiteSpeed; Nginx does not read .htaccess. Always back up your current .htaccess before you change it.
Your choices and the addresses you type stay in your browser and are not sent to our servers. This online .htaccess maker is free and unlimited, with no sign-up.
How to use the .htaccess generator
- Set the HTTPS and www preference. "Redirect every visit to HTTPS" comes ticked. Under "www preference", choose "Leave as is", "Redirect to the non-www address" or "Redirect to the www address".
- Write your 301 redirects. In "301 redirects", enter one redirect per line: old path, space, new address. Example: /old-page/ https://www.example.com/new-page/
- Pick the speed and security rules. "Compression (Gzip)", "Browser caching", "Turn off directory listing" and "Protect sensitive files" come ticked. Turn on "Security headers", "Block xmlrpc.php" and "Add WordPress permalink rules" as you need them.
- Take the code. In the box headed ".htaccess", press "Copy" to put the code on your clipboard or "Download" to save it as a file. The downloaded file is named htaccess.txt.
- Back up and upload. Keep a copy of the .htaccess currently on the server. Rename the new file to .htaccess, upload it to the root of your site, then open the site and check it.
Frequently asked questions
If your answer is not here, write to us.
Is the .htaccess generator free?
Yes. The SEOLOG .htaccess generator is completely free and asks for no account or email. There is no usage limit; generate rules for as many sites as you like.
Where is the .htaccess file?
It sits in the root folder of your site; on hosting that uses cPanel this is usually the public_html folder. Because its name starts with a dot it is treated as a hidden file, so turn on the option to show hidden files in your file manager or FTP program. If there is no such file, you can create a new one.
Do these rules work on an Nginx server?
No. The rules are for Apache and LiteSpeed servers; Nginx does not read .htaccess. On an Nginx server the same settings have to be written into the server configuration in Nginx syntax. If you do not know which server you have, ask your hosting company.
My site stopped loading after I changed .htaccess. What should I do?
Restore the backup you took first; the site returns to its previous state at once. A 500 error usually comes from a line the server does not recognise; add the rules back block by block to find the one at fault. If the browser reports too many redirects, the HTTPS or www redirect may be clashing with another redirect set in your hosting panel or CDN.
Should I overwrite the existing .htaccess on my WordPress site?
No, do not delete the existing file. WordPress and caching or security plugins write their own rules into it. Add the blocks you generate at the very top of the current file and leave the section between "# BEGIN WordPress" and "# END WordPress" untouched. The "Add WordPress permalink rules" box is only needed when you build the file from scratch.
Similar free tools
All Utility Tools- SEO Tools Robots.txt Generator & Tester Choose which pages Google and AI bots may crawl, then download the file. Open tool
- WordPress Tools WordPress Security Keys (Salt) Generator Generate the eight security keys for wp-config.php and paste them in. Open tool
- WordPress Tools WordPress Password Hash Generator Create a WordPress hash to reset your admin password from the database. Open tool
- Utility Tools Strong Password Generator Create an unguessable password in one tap and copy it. Open tool
Planning a new website?
We design websites that load fast, are SEO-friendly and are easy to manage.