Htaccess File Generator

Generate texts to describe in .htaccess from various options

Add to favorite

URL normalization

Index to /

301 redirect

Caching Javascript file, CSS file, and image file

Separated by ', (comma)', omitting '. (dot)' at the beginning

Basic authentication (requires .htpasswd file)

Generate .htpasswd hashed password

Prevent Hotlinking

Domains that allow Hotlinking
Separated by ', (comma)', omitting '. (dot)' at the beginning
Contents to show instead when getting hotlinked

Custom error pages (400, 404, 500, etc.)

Allow / deny IP address / domain

separated by ',(comma)'
separated by ',(comma)'

Change directory index

Prevent access to .htaccess

Prevent access to directory list and file list

Gzip compression

Copy Clear
Copy Clear

What this tool can

By choosing various options and describing the generated text in .htaccess file, you can quickly create .htaccess file.
You can also generate hashed passwords for Basic authentication (.htpasswd).

What is .htaccess file?

A setup file to manage HTTP server like Apache.
Settings such as basic authentication, redirection, and error page can be set for each directory.

What is .htpasswd file?

It is used to protect files, folders, or entire websites using HTTP user authentication called BASIC authentication, and is implemented based on the rules described in the .htaccess file.
User information is written on one line per user, and each line contains a username and password separated by a colon (:). Usernames are stored in plain text, but passwords are stored in hashed form.
You can give the password file any name, but since Apache uses .htpasswd by default and dot files (files starting with '.') become usually hidden files, it is recommended to name a file as '.htpasswd'.

Frequently used settings of .htaccess files :

  • Rewrite non-www to www/ Remove www from URL
  • Redirect http/ https
  • Redirect to file or directory
  • Caching Javascript, CSS or images
  • Setting Basic authentication
  • Hotlink prevention setting
  • Custom Error Pages (400, 404, 500, etc) setting
  • Block or Allow IPs
  • Block bots
  • Change default directory page
  • Rejecting access to . (dot)
  • Prevent directory listing
  • Enable gzip

Rules with .htaccess file

  • .htaccess file works with the current directory and all of its subfolders.
  • If the .htaccess file fails to run, a 500 error is returned to the client. So please be careful when editing it. Before editing, it is recommended to make a copy as a backup.
  • Use “#” before a line you don’t want to run to switch the line to comment mode.

Useful for

  • Generating .htaccess when setting up a web server when you don’t know how to write .htaccess

related tools