htaccess
Magento 2 static files are not working
How many times you tried to install Magento 2 and later you could not see the website working !!, How many times you tried to search for these sentences
"Magento 2 css not working"
"Magento 2 js not working"
"Magento 2 404 page not found" because of the static files?
Now here is the solution, and easily it is the missed .htaccess (for apache)
by quick look at this path "{magento root}/pub/static", you will see that you missed the .htaccess file
How to remove index.php from url if we enter manually
RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC]
RewriteRule (.*?)index\.php/*(.*) /$1$2 [R=301,NE,L]
Enable gzip compression for PageSpeed
Find your .htaccess file in the root of your domain. This file is a hidden file but should show up in FTP clients like FileZilla or CORE. You can edit the .htaccess file with notepad or any form of basic text editor.
In this file we will set our caching parameters to tell the browser what types of files to cache
Configuring Apache to serve the appropriate headers - leverage browser caching
Find your .htaccess file in the root of your domain. This file is a hidden file but should show up in FTP clients like FileZilla or CORE. You can edit the .htaccess file with notepad or any form of basic text editor.
In this file we will set our caching parameters to tell the browser what types of files to cache