.htaccess

directory-level configuration file

.htaccess is a type of computer file for the configuring of some web servers. .htaccess files can be used to create custom error pages, or to prevent visitors from directly linking pictures, also known as hot-linking to their own sites, costing the website owner bandwidth and therefore money.[1][2][3][4]

Preventing direct or Hot-linking

change

A .htaccess file is put onto the website, so that people will not be able to go onto the URL of the image (picture) (example: www.website.com/image.filetype). Owners can replace this picture, after they upload the file, with a message, or it can be made to redirect to an error page.

Examples of .htaccess being used

change

MediaWiki

change

By default, MediaWiki uses http://www.example.org/index.php/Main_Page type of URL to display the main page. But by changing the .htaccess and LocalSettings.php, it can display URLs like http://www.example.org/wiki/Main_Page so that it will look nicer (like Wikipedia).

Wordpress

change

By default, all posts made in Wordpress uses http://www.example.org/?p=123 to display posts. But it can be changed into URLs like http://www.example.org/2010/06/postname in .htaccess and the permalink setting in the site admin of that blog.

.htaccess

change

htaccess file is to cache the image on the browser so that next time the website does not take much time to load.

References

change
  1. "htaccess". WordPress.org Forums. 2018-11-02. Retrieved 2021-12-29.
  2. "Apache Configuration: .htaccess - Learn web development | MDN". developer.mozilla.org. Retrieved 2021-12-29.
  3. "How to Edit Your .htaccess File | HostGator Support". www.hostgator.com. Retrieved 2021-12-29.
  4. "Password protecting your site with an htaccess file". Archived from the original on 2021-12-29. Retrieved 2021-12-29.