cancel
Showing results for 
Search instead for 
Did you mean: 

Magento 2.1.9 CSS and JS files are not working on both the frontend and admin panel

SOLVED

Magento 2.1.9 CSS and JS files are not working on both the frontend and admin panel

I have Magento 2.1.9 installed on my cPanel shared hosting account. Everything worked fine until I asked my hosting provider to run the necessary commands during Tawk.to chat integration. The commands he ran made my site to display blank pages.


I managed to get the site back online by running the following commands:

php bin/magento setup:upgrade php bin/magento
php setup:static-content:deploy
bin/magento cache:flush
chmod -R 777 var pub

Even though I can now access my site, but the CSS formatting and JavaScript in both the admin panel and frontend don't work.
See how my admin panel looks like:
Note: In line 607 of the app/etc/di.xml file, I had already changed the following content:

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

to:

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


Does anyone know how to fix this issue?

Please, note that I set the file permissions for the directories below to 777.

/pub/
/pub/static/

And the following have 775 permissions

/pub/static/cache/
/pub/static/frontend/
/pub/static/adminhtml/
/pub/static/_requirejs/

What are the proper file permissions for the above-mentioned directories? 755 or 777?

Please, I'd really appreciate your time and insight in helping me to resolve this issue. Thanks.

6 REPLIES

Re: Magento 2.1.9 CSS and JS files are not working on both the frontend and admin panel

@FlamyTechDo you see any error in browser console? You can also inspect the element and try to browse the URL of JS/CSS file directly in the browser. This will give you more insight on the issue.

 

Problem solved? Give kudos and accept answer as Solution.

Thanks,
Tarandeep
Magento 2 Certified Solution Specialist (x2). Follow me on Twitter

Re: Magento 2.1.9 CSS and JS files are not working on both the frontend and admin panel

Thanks, but I've already done a fresh installation of Magento.

Re: Magento 2.1.9 CSS and JS files are not working on both the frontend and admin panel

@FlamyTechIs your issue is resolved or still need help with it?

Thanks,
Tarandeep
Magento 2 Certified Solution Specialist (x2). Follow me on Twitter

Re: Magento 2.1.9 CSS and JS files are not working on both the frontend and admin panel

@hellotaran, I can say the issue is over, because I deleted that installation from the server and installed another one. Thanks a lot.

Re: Magento 2.1.9 CSS and JS files are not working on both the frontend and admin panel

Hi i am using godaddy sharing host server. I am also facing same issue when I installed magento 2. Unable to load css and images, js. Can you please guide me how to resolve the issue.
Tags (1)

Re: Magento 2.1.9 CSS and JS files are not working on both the frontend and admin panel

@MysehariI believe you need to clear the cache and deploy the static content to make it working. Let know if that works for you.

 

Problem solved? Please give Kudos.

Thanks,
Tarandeep
Magento 2 Certified Solution Specialist (x2). Follow me on Twitter