【问题标题】:How to use Magento 2 with an openlitespeed (free) web server?如何将 Magento 2 与 openlitespeed(免费)网络服务器一起使用?
【发布时间】:2018-12-02 15:19:58
【问题描述】:

我正在尝试使用 OpenLiteServer 设置 Magento 2.3.0 服务器并不断遇到奇怪的重写规则错误:

这是full list 的错误。

website 工作正常,但 CSS 和 JS 无法加载,所以有很多 404

我在想我可能做错了什么,或者 OpenLiteSpeed 不支持 .htaccess 文件中的所有这些命令。

magento 2 安装只是一个基本的 magento 2.3.0 composer 安装,没有添加任何东西,因此设置为 default 模式。

文件权限看起来也不错,但请注意pub/static/frontend/luma/en_US/ 目录中缺少文件:

有什么提示吗?

谢谢

【问题讨论】:

    标签: .htaccess magento2 magento-2.0 litespeed magento-2.3


    【解决方案1】:

    假设网站位于/magento2 下,您需要在虚拟主机上插入重写,在重写部分,也启用重写模块。

      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]
    

    【讨论】:

      猜你喜欢
      • 2011-02-01
      • 1970-01-01
      • 2012-05-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-02-25
      • 2020-07-20
      • 2019-03-02
      相关资源
      最近更新 更多