Yes, OpenLiteSpeed (OLS) supports mod_rewrite rules in .htaccess file, but currently it is done with some restrictions. The mod_rewrite rules from .htaccess are loaded by OLS at a start time only.
Practically it means, every time you modify rewrite rules in .htaccess file via FTP/SSH/sFTP you need to reload OpenLiteSpeed. The web server won't either read your changes or find new .htaccess file until you reload/restart it.
Are there any options?
A reload of OpenLiteSpeed is possible from an user level in DirectAdmin, it's auto-done in a File Manager at a .htaccess edit time. So, once you modified a .htaccess file and saved it, directadmin will reload OLS so that new rewrite rules could take effect.
If you still want to modify .htaccess file via FTP, then you can set up a cron task to do a graceful reload of OpenLiteSpeed.
When doing a /usr/local/lsws/bin/lswsctrl restart a graceful reload with a zero downtime will be preformed (if all rewrite rules are done without errors and typos).
Directadmin developers offer the following solution.
Here is a line for crontab, do not try to run it in a shell:
*/3 * * * * root if ! find /home/*/domains/*/*_html/ -maxdepth 2 -type f -newer /usr/local/lsws/cgid -name '.htaccess' -exec false {} +; then /usr/local/lsws/bin/lswsctrl restart; fi
To get the crontask installed run the following command as root:
echo '*/3 * * * * root if ! find /home/*/domains/*/*_html/ -maxdepth 2 -type f -newer /usr/local/lsws/cgid -name ".htaccess" -exec false {} +; then /usr/local/lsws/bin/lswsctrl restart; fi' > /etc/cron.d/openlitespeed_htaccess_scan
Check the file and make sure it was populated with the correct line:
cat /etc/cron.d/openlitespeed_htaccess_scan
This way a crontask to search recently modified .htaccess files and restart OpenLiteSpeed will be set up.
If mod_rewrite rules do not work as expected you might check and see /var/log/httpd/error_log for possible errors, e.g.:
2019-05-06 19:11:02.548722 [ERROR] [(null)] rewrite: invalid rewrite condition while parsing: RewriteCond %{HTTP_HOST} ! ^example.net [NC] 2019-05-06 19:11:02.553827 [ERROR] [(null)] rewrite: invalid rewrite condition while parsing: RewriteCond %{HTTP_HOST} ! ^example.net [NC]
The logs might give you tips on what is wrong with the rules.