11

CSS and JS not loading after installation of Magento 2 default template

OS: Windows 10
Xampp Control panel V3.2.2
PHP version: 5.6.28
Server: Apache/2.4.23 (Win32)
phpmyadmin Version information: 4.5.1

enter image description hereenter image description here

  • Did you run the static content deploy command? – Khoa TruongDinh Jan 14 '17 at 13:11
  • Yes. Run this command: php bin/magento setup:static-content:deploy [locales] – MrTo-Kane Jan 14 '17 at 14:20
14

Its working when i did the following changes:

Remove all files from pub/static folder but not .htaccess

Go to app/etc/di.xml

Replace ('Symlink' --> 'Copy')

Magento\Framework\App\View\Asset\MaterializationStrategy\Symlink

by

Magento\Framework\App\View\Asset\MaterializationStrategy\Copy
4

Step1 :- Go to var folder and check .htaccess file is available or not. If it is not available then copy .htaccess file in default magento2 and paste.

Step2 :- Go to pub\static folder and check .htaccess file is available or not. If it is not available then copy .htaccess file in default magento2 and paste.

Step3 :- Login your ssh/putty and go to root directory and run below command

a). rm -rf var/*

b). rm -rf pub/static/*

c). php bin/magento setup:static-content:deploy

d). chmod -R 777 var pub/static

Step4 :- Refresh your link.

3

Here is the simplest solution if showing version name in css path

like : pub/static/version323334/

then run this query in my sql

 INSERT INTO 'core_config_data' ('path', 'value') 
VALUES ('dev/static/sign', 0) 
ON DUPLICATE KEY UPDATE value = 0;

after that clear the config cache

 bin/magento cache:clean config

you can also disable static file version form admin

enter image description here

2

Changing the

Options +FollowSymLinks

to

Options +SymLinksIfOwnerMatch

in the .htaccess file inside the pub folder in your Magento root directory fixed the problem for me.

2

If you are facing theming issue after Installation in magento 2. You can follow these steps :

  1. Run mysql this query :

INSERT INTO core_config_data (path, value) VALUES ('dev/static/sign', 0) ON DUPLICATE KEY UPDATE value = 0;

  1. For local machine run this mysql query: If dbname us you

UPDATE dbname.core_config_data SET value = '0' WHERE core_config_data.path LIKE '%web/seo/use_rewrites%';

  1. Remove all the files from pub and var directory :

sudo rm -rf var/di var/generation/ var/page_cache/ var/cache/ pub/static/frontend/ pub/static/adminhtml/ pub/static/_requirejs/ pub/static/deployed_version.txt

  1. Give Permission to var and pub directories of your project :

sudo chmod -R 777 var/* pub/*

  1. ** Command for Upgrade Setup :**

sudo php bin/magento setup:upgrade

  1. Command for Deploy content :

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

After these steps, you will be able to see proper theme.

  • Life saver +1.. – anonymous May 20 at 18:44
1

Might be the issue at mod rewrite. Please check the mod rewrite setting at the server. If you have using apache then use below steps for enabling mod rewrite

sudo a2enmod rewrite

sudo service apache2 restart
0

Just delete everything except .htaccess in pub\static and refresh the page will resolve the issue .

0

1.Just delete var/view-processed/pub folder.Also delete pub/static/frontend/ all folders.

2.In mysql core_config_data,check whether dev/static/sign has scope-default ,scope id- 0 and value 0.If field not present, create it.

3.Then run php bin/magento setup:static-content:deploy -f php bin/magento cache:flush

0

In command line Magento root directory use the following commands.

  1. php bin/magento setup:upgrade

  2. php bin/magento cache:clean

  3. php bin/magento setup:static-content:deploy

               or
    

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

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.