resources not loading after changing base url. i have tried changing base_url for media files.
- 49
- 1
- 1
- 2
-
4Possible duplicate of Magento 2 CSS and JavaScript not loading from correct folder – Asish Hira Apr 28 '16 at 08:05
-
my problem is that magento is looking directly in root floder for media and static files. it is not looking in pub/media folder – usama Apr 28 '16 at 08:15
-
1Check the presence of .htaccess file inside pub/static. While Deleting the files under pub/static to get rid of any existing symlinks, we need to be be careful not to delete the .htaccess file. – Suyash B Jan 09 '17 at 11:37
6 Answers
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.
- 145
- 1
- 11
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
- 51
- 5
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
- 2,170
- 7
- 26
- 29
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
- 11
- 2
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.
- 1,416
- 1
- 14
- 37
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.
- 101
- 1