One of the most alluring features of OpenLiteSpeed is that it is highly compatible with Apache, so web admins migrating from Apache web server to OpenLiteSpeed will not have to spend much time converting their configuration. When using the Apache web server,
.htaccess files (also called “distributed configuration files”) are used to specify configuration on a per-directory basis, or more generally to modify the behavior of the Apache web server without having to access virtual hosts files directly (this is usually impossible for example, on shared hosts).
.htaccess files were developed with Apache in mind, OpenLiteSpeed also has the ability to read them. This makes OpenLiteSpeed able to act as a drop in replacement for those wishing to migrate from Apache. In order for OpenLiteSpeed to recognize
.htaccess files, the pertinent setting must be enabled. In this tutorial, you will see how to enable htaccess support in OpenLiteSpeed on a Linux system.
In this tutorial you will learn:
- How to change listening port for OpenLiteSpeed web server
- How to enable HTTP or HTTPS for the listening port
|Category||Requirements, Conventions or Software Version Used|
|System||Any Debian Linux or Red Hat Enterprise Linux based Linux distro|
|Software||OpenLiteSpeed and LiteSpeed web servers|
|Other||Privileged access to your Linux system as root or via the
# – requires given linux commands to be executed with root privileges either directly as a root user or by use of
$ – requires given linux commands to be executed as a regular non-privileged user
OpenLiteSpeed htaccess setup step by step instructions
.htaccessfile gets placed into a directory, and allows administrators to specify instructions that apply to that directory.
OpenLiteSpeed only supports
mod_rewriterules from Apache’s htaccess files. Other rules inside of the files will not be recognized, and will have to be manually configured within OpenLiteSpeed.
Follow the step by step insructions to configure OpenLiteSpeed to recognize your website’s htacces files:
- Get started by navigating to the OpenLiteSpeed web admin panel located at https://localhost:7080/login.php and log in with your admin user name and password. In case you have not yet configured one, see our guide on OpenLiteSpeed default password.
- If you would like to enable htaccess support across the entire web server, head to Server Configuration > General > Rewrite Control. Change the ‘Auto Load from .htaccess’ option to ‘Yes’ as seen below.
- If, instead, you would only like a particular virtual host to recognize htaccess files, head over to Virtual Hosts > Select your virtual host > Rewrite. Change the ‘Enable Rewrite’ and ‘Auto Load from .htaccess’ options both to ‘Yes’ as seen below.
- Do not forget that you need to perform a graceful restart in order for the new changes to take effect. Afterwards, your web server or virtual host (depending on which configuration option you chose) will recognize the rewrite rules within the .htaccess files in each directory.
In this tutorial, we saw how to enable and disable the
.htaccess file for an OpenLiteSpeed server on a Linux system. This configuration file allows for simple and granular rules to be applied on a per directory basis, but is slower than applying your rules directory to the OpenLiteSpeed virtual hosts settings. Still, on shared hosting or in other situations, it proves to be the most viable method for applying rewrite rules.