PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Wednesday, December 7, 2022

[FIXED] How to use Magento 2 with an openlitespeed (free) web server?

 December 07, 2022     .htaccess, litespeed, magento-2.0, magento-2.3, magento2     No comments   

Issue

I'm trying to setup Magento 2.3.0 server with OpenLiteServer and keep on bumping weird Rewrite rule errors:

LiteSpeed errors

Here's the full list of errors.

The website is working, but CSS and JS cannot be loaded so there are lot's of 404s

tyanabelle.com

I'm thinking that I may be doing something wrong, or that OpenLiteSpeed does not support all of those commands inside the .htaccess files.

The magento 2 installation is just a basic magento 2.3.0 composer installation without anything added to it, and thus is set to default mode.

The file permissions are looking good too, but note that files are missing from the pub/static/frontend/luma/en_US/ directory:

permissions

Any hints?

Thank you


Solution

Assuming that the website is under /magento2 you'll need to insert the rewrites on the virtual host, at the rewrites section, enable the rewrite module as well.

  RewriteRule ^/magento2/pub/static/version.+?/(.+)$ /magento2/pub/static/$1 [L]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-l
  RewriteRule /magento2/pub/static/.* /magento2/pub/static.php?resource=$0 [L]
  RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
  RewriteCond %{REQUEST_METHOD} ^TRAC[EK]
  RewriteRule .* - [L,R=405]
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_FILENAME} !-l
  RewriteRule .* /magento2/index.php [L]


Answered By - user7678643
Answer Checked By - Clifford M. (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing