我已经下载并安装了 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/