.htaccess is a file for controlling the basic operation of the Web server on a directory-by-directory basis. It supports several web servers, including Apache.

You can do various things by using .htaccess.

1. Redirect
Guide visitors to the new website
If you run a website, you may change the structure of your domain or site. At that time, visitors who come to see the page before the move must be smoothly guided to the page at the move destination. In such a case, the “redirect” setting is convenient.

By setting “redirect” in .htaccess, if a visitor visits an old page, that access can be automatically redirected to the new page. From the visitor’s point of view, when an old page is displayed in the browser, it automatically switches to the new page. There are many websites that use “redirect” on the Internet, so many of you may have seen the pages that were actually set up.

2. Basic Authentication
Add ID / password authentication to the website
There may be cases where you want to publish part or all of the content of the website to a limited range, such as within the company or only to customers. In such a case, you can use the “Basic Authentication” setting using .htaccess. With Basic Authentication, you can restrict access to the website by user name and password.