T

Text Machine

Powerful text tools, in your browser

.htaccess Generator

Generate common .htaccess rules for your website. Select the options you need and copy the generated code.

Options

Performance

Security

Generated .htaccess Code
Important Notes

• 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. 1

    Enter your domain

    Type your domain name, such as example.com, in the Domain Settings field.

  2. 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. 3

    Add redirects

    For URL redirects, enter the old and new paths and choose a permanent 301 or temporary 302 redirect.

  4. 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?
It builds common Apache rules including forcing or removing www, forcing HTTPS, 301 and 302 redirects, GZIP compression, cache control, hotlink protection, custom error pages, MIME types, and default index files.
What is the difference between a 301 and 302 redirect?
A 301 is a permanent redirect that passes SEO value to the new URL, while a 302 is temporary and tells search engines the original URL will return.
Where do I put the generated .htaccess file?
Place it in the root directory of your website on an Apache server. The rules take effect immediately, so back up any existing .htaccess first.
Does this work on Nginx or other servers?
No. The .htaccess format is specific to Apache (and compatible servers with mod_rewrite). Nginx uses its own configuration syntax instead.
Is the generated code sent anywhere?
No. The rules are assembled in your browser from the options you select, so nothing is uploaded, and the tool is free to use without registration.

Related tools

Keep going with these handy tools

URL Redirect Chain Checker

Meta Tag Generator

Robots.txt Generator

Open Graph Previewer

HTML Entity Encoder/Decoder

HTTP Header Viewer