OpenLiteSpeed won't read .htaccess files

#1
I decided to test litespeed again after a few years since the open source version was not mature enough for my dev box. Install on CentOS was great, I was able to manage everything on the test box except I had no problems with Apache and once I replaced it with Litespeed I have nothing but problems with rewrite rules.

I understand this is an enterprise feature but I assumed that now rules are support on the open source version. Without them the server is not usable at all because almost every website, framework today has some kind of rewrite rules in place. To resume, everyone that needs to run PHP can't use this in the current state without being able to read .htaccess files. Every single app I know has some rules.

I have tried absolutely everything, the server completely ignores .htaccess files. Even a default installation with the Example folder, the .htaccess file in that example folder is useless. I have enabled rewrite in the server global settings, in the virtual host, I have tried everything for hours, search multiple solutions, nothing works.

I tried gazillion different rules, even some basic ones to test if they work like:
RewriteRule /.* /somenonexistentfolder/index.php [F]

Nothing. If I put them in the admin web console, they work. But the server will refuse to read anything in a .htaccess file, root folder, subfolders, nothing.

I have also searched this forum and the only thing I found recently was this:
https://www.litespeedtech.com/suppo...g-on-openlitespeed-install.17434/#post-105940

I understand that only rewrite rules are supported on .haccess and not other rules, but even that does not work in my case. The server just completely ignores the .htaccess file. I checked permissions, I enabled debug 9 on the vhost, nothing. Nothing in the logs either. If the rules are wrong at least it would record something in the debug console but my problem is not the server not understanding the rules but it seems its just not using or ignoring the file completely. As index files I have set index.php and index.html, I'm not sure if I have to enable something in the server so it starts reading .htaccess files on folders because nothing I tested works. I'm starting the belive this version is bugged. If its not, this is seriously not usable out of the box. I can just remove the server and reinstall apache in 10 minutes and have everything working again, even NGINX works out of the box and most apps have rules for that server as well. A normal person should not be playing hours and hours to get something basic working. I'm not talking here about complex rules, but just read the .htaccess

I installed the server yesterday so I assume its the latest version.
 
Last edited by a moderator:

Unique_Eric

Administrator
Staff member
#2
@chmod000 ,

Something not right on your server since OLS does support read rewrite rules from .htaccess file for a very long time.

We also build some images with some rewrite rules, e.g. force https inside of the .htaccess file and it works no issue. Also many wordpress users on OLS have no issue too.

If you don't mind, please send server access to let Litespeed support team to help you pointing out the issue.
send here: bug@litespeedtech.com

Best,
Eric
 
#3
Fine, I don't mind putting them from the admin console manually. It seems that does work since I see things logged in the error log in the server. Except of course I cannot make my rules work.

I have a simple framewok and just like every single framework in existence it has rules to remove the index. Something as simple as this will not work:
Apache config:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule . index.php [L]
I also tried
Apache config:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule . /index.php [L]

And nothing. The problem with this approach of using the web console for the rules is that I need to apply them only to a specific folder, not the whole virtual host. This is not asking something fancy. I don't mind doing this manually since its for my own use but I'm starting to give up on this, most apps have rules that work out of the box for Apache and Nginx, not Litespeed. For some reason Litespeed does not read them like another server would, and the reason is that you can't apply them on a specific folder but globally for the whole virtual host unless I'm missing something,.
 
Last edited by a moderator:

Unique_Eric

Administrator
Staff member
#4
Hi @chmod000 ,

Forgot to ask did you do restart lsws, .e.g. service lsws restart after putting rules inside of the .htaccess? Please give it another try, if still not work, then we need to access to the server and check.

By the way, you can post openlitespeed related in Openlitespeed' forum next time.
https://forum.openlitespeed.org/

best
 
Last edited by a moderator:
#5
Of course I restarted it. I finally found the problem. It seems using the vhost rewrite option does not work as its globally and I tried to set the path to the folder for ages now. As you can understand this is hard to get right as with Apache you just put the .htaccess into the folder you wan't to apply the rules and thats it. It seems with Litespeed you need to add the rules in the context. So I had to create the context for the proper folder and put the rules there, very annoying but it seems that finally applied the rules only for that folder. This is fine for someone doing it manually like me but now I can see why .htaccess reading is only available on the enterprise version. Doing this by hand for plenty of users would be a nightmare.

One of the reasons it took me so long to figure out is because I was not aware the open source version could not read .htaccess files until you told me here .This is not clear at all, in the software or even the features comparison page. The option to read .htaccess files should not be available on this version it does not work. Why have the option to enable this on the web interface if its has no effect? That is what was driving me crazy since I had no idea why the rules did not work. I also found tutorials online that explained how to use the .htaccess with the open lite speed version. I guess that information is also outdated or wrong.
 
Top