Theme broken after manually clearing the pub/static folder

Hi @digitalstartup, how do you deal with 404. In my case JS files seems missing. (Just to provide a context, It was working fine previously. I wanted to update to the version 2.3.3 and removed some unsupported modules then it broke everything)

  • I think the issue started when I manually cleaned pub/static folder, I removed .htaccess file. But then I made a copy from root directory to pub/static still not working
  • I have tried running setup:upgrade, setup:static-content:deploy -f, setup:di:compile (no result)

What do you suggest ? Thanks for the help in advance

Hi @Amir and welcome.

Removal of the .htaccess file in pub/static will break static assets because the file is required for PHP Rewrites to work - Hence the 404.

This file cannot be replaced with the version in the Magento root directory because the contents of the file are completely different. The only thing they have in common is the filename.

If you wish to replace the original .htaccess file in pub/static then take a copy of the original from the Official Magento 2 GitHub Repo.

1 Like

Thank you @digitalstartup it works, Thank you also for your fast response and for all your tutorials. This is my first post in this forum but I’m always following on YouTube and I learned a lot from your videos.

1 Like

You’re welcome. I just happened to check the forum when I did. Thankfully, it was a nice easy fix.

Good luck with the rest of your project.

1 Like