.htaccess Generator
Generate common .htaccess rules for your website. Select the options you need and copy the generated code.
Performance
Security
• The .htaccess file should be placed in the root directory of your website
• Make sure mod_rewrite is enabled on your Apache server
• Always backup your existing .htaccess file before replacing it
• Some hosting providers may restrict certain .htaccess directives
How to use .htaccess Generator
- 1
Enter your domain
Type your domain name, such as example.com, in the Domain Settings field.
- 2
Select the rules
Check the options you need, like Force HTTPS, Force or Remove www, GZIP compression, hotlink protection, or custom error pages.
- 3
Add redirects
For URL redirects, enter the old and new paths and choose a permanent 301 or temporary 302 redirect.
- 4
Copy or download
Use Copy to Clipboard or Download .htaccess and upload the file to your site's root directory.
Frequently asked questions
What rules can this generator create?
What is the difference between a 301 and 302 redirect?
Where do I put the generated .htaccess file?
Does this work on Nginx or other servers?
Is the generated code sent anywhere?
Related tools
Keep going with these handy tools