4

**resources not loading after changing base url** resources not loading after changing base url. i have tried changing base_url for media files.

usama
  • 49
  • 1
  • 1
  • 2

6 Answers6

2

Magento 2.2.2

Apache/2.4.6 (CentOS)

I tried:

rm -rf pub/static/* generated/* var/page_cache/* var/cache/* var/view_preprocessed/*
chown -R apache:apache .*
find . -type d -exec chmod 0770 {} \;
find . -type f -exec chmod 0660 {} \;
php bin/magento cache:clean
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy -f

Found out the pub/static/.htaccess file was missing. Added it back in and static content showed up.

Bernard
  • 145
  • 1
  • 11
2

Sometime it is a hosting settings issue - its try to find "static" folder directly in magento root "/" but not in "pub/"

To fast fix it try to make symbol link in magento root directory

$ ln -s pub/static static

kmv
  • 51
  • 5
1

In your magento root directory run the below command..

for windows system: php bin/magento setup:static-content:deploy

For Linux/Ubuntu: bin/magento setup:static-content:deploy

Mohammad Mujassam
  • 2,170
  • 7
  • 26
  • 29
1

I had the same issue in magento 2, Ubuntu 16.04. You can resolve it by running the following command in your magento 2 root directory

sudo php bin/magento setup:static-content:deploy

In case it gives a warning and fails, run the above command forcibly, like,

sudo php bin/magento setup:static-content:deploy -f

Post this step, you will have to compile magento setup once again. So, run the following command.

sudo php bin/magento setup:di:compile

Azher
  • 11
  • 2
1

Many of the answers here are good, but all are pieces in a puzzle where there are many such pieces... Therefore, you may need to work through several of the answers on this page to solve your issue.

I am using Apache as well and simply found I needed to enable mod-rewrite for the rewrite rules in the htaccess file(s) in the pub directory to work.

quickshiftin
  • 1,416
  • 1
  • 14
  • 37
0

None of this worked for me. The problem was apache. Needed to set AllowOverride All in the virtualhost due to Magento's many many .htaccess files.