Magento2: static and media url with
Versione Italiana

Leggi questo articolo in italiano: click here


Follow GitHub Issue to read all the discussion. Other Github Issue with the same problem.


Reproduced on these versions:

  • 2.1.x
  • 2.2.x
  • 2.3.x


Preconditions

  • document root of the project is /pub
  • modalità production is on


Problem

All CLI commands returns the url with subfolder /pub


Solution

Add to your app/etc/env.php this code:

<?php
return [
    ...
    'directories' => [
        'document_root_is_pub' => true
    ],
    ...
];

Change your admin setting like this:

General > Web > Base URLs > Base URL for User Media Files to

{{unsecure_base_url}}media/

General > Web > Base URLs (Secure) > Base URL for User Media Files to

{{secure_base_url}}media/

Do you need help with your e-commerce?

Find out how I can help you

Write an email or arrange an appointment

Contact Me
Blog Comments powered by Disqus.