Skip to contentSkip to main navigation Skip to footer

Config .htaccess in OpenLiteSpeed: A Step-by-Step Guide

Source: linuxconfig.org

OpenLiteSpeed’s compatibility with Apache makes it an attractive choice for web administrators looking to migrate seamlessly. One of the essential features it inherits from Apache is the support for .htaccess files, allowing users to configure settings on a per-directory basis.

In this tutorial, we will explore how to enable .htaccess support in OpenLiteSpeed on a Linux system, ensuring a smooth transition for those accustomed to Apache’s configuration structure.

Step-by-Step Guide:

Step 1: Accessing OpenLiteSpeed Web Admin Panel: Start by navigating to the OpenLiteSpeed web admin panel at https://localhost:7080/login.php and log in with your administrator credentials.plaintextCopy code$ https://localhost:7080/login.php

Step 2: Enabling .htaccess Support: If you wish to enable .htaccess support for the entire web server, go to Server Configuration > General > Rewrite Control. Change the ‘Auto Load from .htaccess’ option to ‘Yes.’

Step 3: Virtual Host Configuration: If you prefer enabling .htaccess support for a specific virtual host, navigate to Virtual Hosts > Select your virtual host > Rewrite. Change both the ‘Enable Rewrite’ and ‘Auto Load from .htaccess’ options to ‘Yes.’

Step 4: Performing a Graceful Restart: After making these changes, perform a graceful restart for the configuration to take effect. This step is crucial for the web server or virtual host (depending on your configuration choice) to recognize the rewrite rules within the .htaccess files in each directory.plaintextCopy code# /path/to/openlitespeed/bin/lswsctrl restart

Conclusion:

In this tutorial, we have learned how to seamlessly integrate .htaccess support into OpenLiteSpeed on a Linux system.

Whether configuring it server-wide or for a specific virtual host, the process ensures that the web server recognizes and implements the specified rewrite rules within the .htaccess files.

This flexibility allows web administrators to retain the convenience of per-directory configuration while enjoying the benefits of OpenLiteSpeed’s performance and compatibility.