Htaccess

Learn what htaccess is in relation to virtual host Click and read more.
Mieszko Wawrzyniak
Co-founder & CTO
facebooktwitter
tiktok v2
youtube
linkedinn
mockup

What is Htaccess file - Definition

Htaccess (Hypertext Access) Htaccess file is a primary server configuration file created by the developer, in which specific rules are defined for the application's behavior in certain situations. Htaccess file is the default Apache web server configuration file used to change the behavior of the web page server. This main server configuration file will set directives that define the basic settings of directories and subdirectories located on the server. A virtual hosts read orders written in the .htaccess files with every request sent to the server, so the effects of its modifications are visible immediately.

Table of contest

An example application of the htaccess server configuration files

The most commonly used directives in the htaccess file (mainly during SEO/DEV activities) are:

  • 301 redirect one address to another (within the same or different domain),
  • 301 redirect from www to non-www (or non-www to www)
  • turning a website from a version without SSL (HTTP) to a version with SSL (HTTPS),
  • creating so-called friendly links,
  • custom error pages, custom error documents, and an error message
  • activating browser cache (which is one of the factors checked during Google PageSpeed Insight tests),
  • blocking file access for bots or specific IP addresses,
  • blocking direct linking (hotlinking),

Correct htaccess files

Since the configuration file is a plain text file, we can use a standard text editor (such as Notepad) to create or edit it. Nothing prevents using an advanced text editor (e.g., Notepad++). By default, a dot precedes a file name and devoids any extension. ".htaccess". However, we may find a file with a different name on the server. When the file is ready, you should upload it to the server. You can do it with any FTP client. The program needs to show us hidden files (because that's what .htaccess is).

❤️ Spread the word! ❤️

Was this blog post helpful to you? Don't forget to share it with your friends and colleagues to help them level up their marketing skills too!
facebooktwitter
tiktok v2
youtube
linkedinn

Start getting customers from Google now!

9K+ business owners like you have added Localo to their toolkit and promoted their local businesses with ease.
Get Started Now
google-business-profile-management-tool