1

I had a problem with magento 2, where in localhost I created the website and everything was fine, after importing to my server the CSS and JS was not working.

I search for so many answers and still no luck, after awhile I decided to simply start again, so I imported magento to my server, installed it with no errors, but when I entered the home page the CSS and JS does not work.

Here's a couple of things I already tried:

php bin/magento setup:content-static:deploy

deleting the static folder and keep the .htacess and run

 php bin/magento setup:content-static:deploy

Replacing Symlink with Copy

Checking the folders permissions

Here is the link of my website: http://maquinasdeoutrostempos.pt/

Thanks in advance

  • Please check this link which could help you magento.stackexchange.com/questions/154728/… – Venkatesh Mar 25 '18 at 14:21
  • @Venkatesh i tried it but still doesn't work. – Ruben Perdigao Mar 25 '18 at 14:27
  • Have you tried this "INSERT INTO 'core_config_data' ('path', 'value') VALUES ('dev/static/sign', 0) ON DUPLICATE KEY UPDATE value = 0;" in Database. – Venkatesh Mar 25 '18 at 14:31
  • @Venkatesh it says that i have a syntax error in : ('path', 'value') VALUES ('dev/static/sign', 0) ON DUPLICATE KEY UPDATE value = 0 – Ruben Perdigao Mar 25 '18 at 14:36
  • Please try this "INSERT INTO core_config_data(path, value) VALUES ('dev/static/sign', 0) ON DUPLICATE KEY UPDATE value=0;" – Venkatesh Mar 25 '18 at 14:43
3

1] Check whether file permissions are given properly to all the Magento files

2] In your database run below query into "core_config_data" table and check you get any result or not

SELECT * FROM `core_config_data` WHERE `path` LIKE '%static/sign%'

3] If no then run below query

insert into core_config_data (config_id, scope, scope_id, path, value) values (null, 'default', 0, 'dev/static/sign', 0);

or

4] if "dev/static/sign" value is already exist into table set that 1 to 0

run php bin/magento c:f , php bin/magento s:s:d -f

I hope this solve your problem.

0
  1. Check if you have well your .htaccessin the root project location

  2. Check if you have well the css files in your current theme.

  3. Check if you have well the right permissions 755 in app/design/frontend/Magento/luma/web, app/design/frontend/Magento/luma/web/css/*.css

  4. remove the content folders of pub/static, var/cache, var/page_cache, var/view_preprocessed

  5. Launch this commands:

    • php bin/magento setup:static-content:deploy --theme Magento/luma pt_PT -f

    • php bin/magento cache:clean

    • php bin/magento cache:flush

  • When i go in app/design/frontend/Magento that folder is empty, don't know why – Ruben Perdigao Mar 25 '18 at 16:01
  • Are you using a default Magento/luma ? you did not create a new theme ? – PЯINCƏ Mar 25 '18 at 16:03
  • I did not, i was going to edit the css just – Ruben Perdigao Mar 25 '18 at 17:11
  • ok, so it's normal that you have app/design/frontend/Magento empty – PЯINCƏ Mar 25 '18 at 17:14
  • still the css and js won't work – Ruben Perdigao Mar 25 '18 at 17:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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