how to get open light speed .htaccess working

743 Views Asked by At

I have a working apache cakephp project running but trying to move to open lightspeed

but I am havig issue with htaccess.

I have enabled rewrite and in context in pasted my htaccess which is on apache server, below is my working .htaccess information in apache server but its not working in openlightspeed.

EXPIRES CACHING

RewriteEngine on

RewriteCond %{HTTP_HOST} !^www\. [NC]
RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301] -jamal

RewriteRule    ^$    webroot/    [L]
RewriteRule    (.*) webroot/$1    [L]

Please help if anyone has any idea on how to corectly insert the context section for it to work or any other files needs changing

Thanks in advance

1

There are 1 best solutions below

4
Eric On

General rewrite rule should works on OpenLiteSpeed Web Server. Below example will rewrite request both not start from https and www to https:/www and all goes to /webroot/

RewriteCond %{HTTPS} off [OR] 
RewriteCond %{HTTP_HOST} !^www. 
RewriteRule ^(.*)$ https://www.%{SERVER_NAME}/webroot/$1 [L,R=301]

For example:

I can update the rule if this does not meet your need.