2

I was trying to rectify some ACL issues in my application I removed the static folder inside the pub and I run di:compile and static-content:deploy. Also, I have given 777 permission to var and generated folders, Now when I open the application in the browser no css and js is loaded, I have seen many similar issues but in my case the css and js files are available but the version folder is not available I mean if I saw the source code the URL's are like

http://ipaddress/magento2/pub/static/version1515489121/adminhtml/Magento/backend/en_US/extjs/resources/css/ext-all.css

But the actual file is like

/var/www/html/magento2/pub/static/adminhtml/Magento/backend/en_US/extjs/resources/css/ext-all.css

As I mentioned in the example the version folder is not showing

I don't understand how the folders are created without the version folder.

2
  • Actually the issue is while removing the static files I should have took the backup for the htaccess file, I missed it. I replace the htaccess file from the repository then its fine.
    – Abel
    Jan 9, 2018 at 12:08
  • But there is no image in the pub/media file.
    – Abel
    Jan 9, 2018 at 12:09

3 Answers 3

0

try to the following:

php bin/magento setup:upgrade

then

php bin/magento setup:di:compile

then

php bin/magento setup:static-content:deploy

then

sudo chmod 777 -R var

and check the following apache2 configuration:

<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>

if you find AllowOverride None

Change it to AllowOverride All

Regards,

1
  • I tried your solution and @qazqaz999 both of them bring back the magento placeholder image instead of broken image but not the original one.
    – Abel
    Jan 15, 2018 at 5:18
0

In this case, you had "Sign Static Files" enabled (found in Magento admin > Stores > Configuration > Advanced > Developer > Static Files Settings).

This is enabled so that the browser can detect when a newer version of a static file (CSS/JS/HTML) is available for use. This is enabled preferably when your site is subject already for go-live.

When you're in production mode (you can check this through php bin/magento deploy:mode:show) and this is enabled, you can't afford to lose the .htaccess file inside the /pub/static folder. The .htaccess file routes the request for the static files' towards /pub/static.php. And this file will load the static files.

1
  • I tried your solution and @Mohamed Elkashef both of them bring back the magento placeholder image instead of broken image but not the original one.
    – Abel
    Jan 15, 2018 at 5:18
0

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

run this query in mysql

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.