.htaccess generator

.htaccess generator

Fill in the form and get your custom .htaccess file

Easily generate feature-rich .htaccess files including www rewrite, hotlink prevention, custom error pages, cache rules and redirects.

Builders and generators

5 Share

Fill in the form

Rewrite to www

Domain name

Redirects example.com to www.example.com

301 Redirect File

Old file path
New file path

301 Redirect Directory

Old Directory path
New Directory path

Caching Javascript, CSS, and Images

File extensions

Comma separated list

Cache duration
Time duration
Public / Private
Must revalidate

Password protect file (requires .htpasswd file)

File name
.htpasswd File path

.htpasswd generator

Username
Password

Prevent hotlinking

Referring url
File extension
No hotlinking image

Custom Error Pages

400 Error file path
401 Error file path
403 Error file path
404 Error file path
500 Error file path

Allow or block IPs

Allow IPs

Comma separated ip list

Block IPs

Comma separated ip list

Change default page
Block bots
Block viewing .htaccess
Block directory listing

What is .htaccess file?

.htaccess file is a plain text powerful file that controls high-level configuration of your website. On servers that run Apache (Apache is a web server software), the .htaccess file allows you to make changes to your website’s configuration without having to edit the server configuration files.

On Apache software the .htaccess files are hidden because this files have important configuration information and can compromise your server capability.

The .htaccess file is commonly located in the public_html folder on web server.

If you don't see your .htaccess file in your public_html folde, you may have to check "Show hidden files". You can access your .htaccess file from your hosting account's file management like "file manager" in cPanel or Plesk.

There are several use cases for the .htaccess file such as add redirect rule for certain file or directory, load custom error pages, force www or https instead of http, password-protect certaind directories, prevent hotlinking, block or allow ips or bad bots, to add Caching shema for certain file extensions ad so on.

You can apply different settings to different directories on your server by using multiple .htaccess files. You can, theoretically, create a .htaccess file in any directory on your server by creating and uploading a plain text file.

Share this Tool

Did you like it? Share it!

Share this tool

Related tools. Try these one!

Generators, builders and validators to improve your SEO and web performances

Home Back to top of the page