javascript - Magento2 不加载图像和 css

标签 javascript css magento http-status-code-404 magento2

我已经下载并安装了 Magento 2,但我收到脚本和 CSS 的 404 错误。我的图片路径示例是:http://www.arredomobilionline.com/pub/static/frontend/Magento/luma/it_IT/images/logo.svg

我已经尝试过这个解决方案:

Open up app/etc/di.xml and find the virtualType name="developerMaterialization" section. In that section you'll find an item name="view_preprocessed" that needs to be modified or deleted. You can modify it by changing the contents from Magento\Framework\App\View\Asset\MaterializationStrategy\Symlink to Magento\Framework\App\View\Asset\MaterializationStrategy\Copy

默认情况下,在我的默认 di.xml 文件中有:

    <virtualType name="developerMaterialization" type="Magento\Framework\App\View\Asset\MaterializationStrategy\Factory">
    <arguments>
        <argument name="strategiesList" xsi:type="array">
            <item name="view_preprocessed" xsi:type="object">Magento\Framework\App\View\Asset\MaterializationStrategy\Symlink</item>
            <item name="default" xsi:type="object">Magento\Framework\App\View\Asset\MaterializationStrategy\Copy</item>
        </argument>
    </arguments>
</virtualType>

我试图删除第一个符号链接(symbolic link)部分或将其更改为“复制”,但它不起作用。 我还为每个文件设置了 777 权限。

最佳答案

使用以下命令导入示例数据并加载 css/js

php bin/magento setup:static-content:deploy<br/> php bin/magento indexer:reindex<br/> php bin/magento cache:flush

并检查受影响的文件夹 pub\static\

关于javascript - Magento2 不加载图像和 css,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33996913/

相关文章:

css - 重力形式的响应按钮

css - 将 CSS 动画应用到文本——如何正确使用?

php - Magento 在保存客户地址时会发送事件吗?

java - Play 2 : get reply from server to AJAX

javascript - 使用 setInterval 时无法将事件添加到 DataTable 分页按钮中

javascript - jQuery 从 HTTP 请求中获取 JSON

javascript - Backbone : annoying behaviour of prototype object

javascript - 滚动条上的 Twitter Bootstrap 导航栏阴影

magento - 从购物车页面的自定义选项中删除价格文本

php - 将时区偏移量转换为小时和分钟保留符号