How can we remove "pub" from the media URL? Like below: www.xyz.com/media/catalog/product from www.xyz.com/pub/media/catalog/product . we have googled but not found any solution. Any help will be appreciated. Thanks in advance.

Magento version 2.3.1.

1 Answer 1


You have to change your Root Directory. Follow DevDoc for more detail https://devdocs.magento.com/guides/v2.3/install-gde/tutorials/change-docroot-to-pub.html

  • Thanks, @Divyarajsinh you saved my day.
    – H_Parekh
    Sep 9, 2019 at 10:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.