2

This question already has an answer here:

I recently encoutered a strage mangento2 behaviour which I cant fix... Everytime i try to load my store (frontend & backend) I get 404 errors on every .css .js .svg and so on.

I tried:

php bin/magento setup:static-content:deploy

php bin/magento indexer:reindex

php bin/magento cache:flush

php bin/magento cache:clear

After checking the directory I saw that I don't got a version<numberhere>-directory. Everything is just placed in the pub/static folder and not pub/static/version<numberhere>.

Thanks in adivce.

marked as duplicate by Siarhey Uchukhlebau, Community Jan 27 '17 at 13:11

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • @SiarheyUchukhlebau OP doesn't state this is M2 2.1.3 – 7ochem Jan 27 '17 at 12:38
2

Most likely the rewrite-module doesn't work at yours web server or you have specified incorrect rewrite settings in the pub/static/.htaccess file. Try to change rewrite base to the:

/pub/static

The rewrite section should look like this (apache):

<IfModule mod_rewrite.c>
    RewriteEngine On

    RewriteBase /pub/static
    # Remove signature of the static files that is used to overcome the browser cache
    RewriteRule ^version.+?/(.+)$ $1 [L]

    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-l

    RewriteRule .* ../static.php?resource=$0 [L]
</IfModule>

If you do not want to use static files versioning you can disable this feature in the Magento admin area:

config

It is possible to change this setting for default scope using the following MySQL query:

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

Then execute next command to clear a configuration cache:

bin/magento cache:clean config

In this answer you can find additional information and configuration file for the Nginx.

  • 1
    Accidentally removed the .htaccess file. Reverted it. – Jordy S Chemparathy Dec 1 '17 at 12:26

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