0

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 Answers1

0

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.

Eric
  • 732
  • 4
  • 13
  • thanks for the reply but what about this part RewriteRule ^$ webroot/ [L] RewriteRule (.*) webroot/$1 [L] – jamal ahmed Nov 16 '19 at 00:58
  • its not rewriting to the path it should its showing me the default page which means its not working or forwarding to webroot for main page – jamal ahmed Nov 16 '19 at 01:00
  • Did you try a restart web server to reload the rule again? `service lsws resstart`. – Eric Nov 16 '19 at 02:28
  • Sorry I can not reproduce it locally. Do you mind to join [LiteSpeed community on slack](http://litespeedtech.com/slack) and direct message me `@eric` there? – Eric Nov 22 '19 at 15:49