How to make OpenLiteSpeed automatically reload after .htaccess changes

Enter Your Query:
Use '%' for wildcards and quotes for "exact phrases"

Top Level » CustomBuild » CustomBuild 2.0 » OpenLiteSpeed

How to make OpenLiteSpeed automatically reload after .htaccess changesLast Modified: May 5, 2019, 1:18 pm
Currently OpenLiteSpeed reads .htaccess on starting time, so, if some new .htaccess files are created, or current ones modified - changes are not in effect until the reload of OpenLiteSpeed service. Please not that DirectAdmin provides customers an ability to reload OpenLiteSpeed directly from the user level, and does this automatically for the .htaccess files edited in File Manager. However, if you would like to have a cronjob setup, which would reload OpenLiteSpeed every X minutes if there are newer .htaccess files that the starting time of OpenLiteSpeed, you may use a cronjob like (*/3 means every 3 minutes, you may change it to happen less/more often):

*/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

Cronjob can be created as /etc/cron.d/openlitespeed_htaccess_scan. It scans for .htaccess files in public/private_html folders, with a max depth of 2 folders (it can be changed to 3, or unlimited at all, however, it could slow the scanning down).

© 2018 JBMC Software, Suite 173  3-11 Bellerose Drive, St Albert, AB  T8N 1P7  Canada.  Mon-Fri 9AM-5PM MST