2

It first started after i set https://(My_Domain_Name).com into Configuration > Web > Base URLs & Base URLs (Secure) > Base URL for Static View Files & Secure Base URL for Static View Files (I'm not even sure if this is the cause). I tried several solutions including: (Solutions from similar problems in stackexchange)

1) Go to pub/static folder and remove everything, except .htaccess file. Open up app/etc/di.xml find the path Magento\Framework\App\View\Asset\MaterializationStrategy\Symlink and replace to Magento\Framework\App\View\Asset\MaterializationStrategy\Copy. (It is already set to Magento\Framework\App\View\Asset\MaterializationStrategy\Copy by default)

2) Using Putty to run below commands

    bin/magento setup:static-content:upgrade
    bin/magento setup:static-content:deploy
    bin/magento indexer:reindex

3) Using Putty to run below commands

    php -dmemory_limit=1G bin/magento setup:upgrade
    php -dmemory_limit=1G bin/magento setup:di:compile
    php -dmemory_limit=1G bin/magento setup:static-content:deploy -f
    php bin/magento cache:clean

4) The permission for /pub/ and /var/ folders is set to 0755 as per default.

I'm using Goddy Hosting > C-Panel > Magento 2.3.1 on Windows 10. First picture is from frontend and second picture is from backend. enter image description here

enter image description here

  • I have check css and js URLs are going 404. can you please execute this command again? php -dmemory_limit=1G bin/magento setup:static-content:deploy -f – Shoaib Munir May 8 at 6:29
  • Ok done. Command output: Execution time: 215.342 – Nicholas Chow May 8 at 6:38
  • still facing same issue? – Shoaib Munir May 8 at 6:42
  • Yes, I've refreshed my website several times but the problem still exist. – Nicholas Chow May 8 at 6:44
  • which magento version you are using? – Shoaib Munir May 8 at 6:52
1

If you deployment script not working for you, then there is something missing in your .htaccess file.

Download same Magento version on your local system, and replace following .htaccess files

ROOT/.htaccess
ROOT/pub/.htaccess
ROOT/pub/static/.htaccess

Edit: in ROOT/.htaccess and ROOT/pub/.htaccess file add following line on top of the file:

SetEnvIf X-Forwarded-Proto https HTTPS=on
  • After I download the same Magento version and replace the .htaccess files, both the frontend and backend have 500 Internal Server Error – Nicholas Chow May 8 at 7:30
  • That's odd... let me check. meanwhile please revert your .htaccess files – Shoaib Munir May 8 at 7:32
  • edited my answer, check now – Shoaib Munir May 8 at 7:34
  • The 500 Inter Server Error still exist after adding the [SetEnvIf X-Forwarded-Proto http HTTPS=on]. How do i revert back my .htaccess files? I replace them with the .htaccess file from my local system that i just downloaded. I think i made a big mistake for not copying the previous .htaccess file. – Nicholas Chow May 8 at 7:46
  • Yes, you should take a backup of old .htaccess files first. I also forgot to mention it in answer. try .htaccess files from this link I have got it from Magento 2.3.1 git code we.tl/t-91IDMk7EIJ – Shoaib Munir May 8 at 7:52
1

I too got this error many times during fresh installation, hope this answer helps you.

Try below sql commands in your db

UPDATE core_config_data SET value = 0 WHERE path = 'web/seo/use_rewrites';

INSERT INTO core_config_data (config_id, scope, scope_id, path, value) VALUES (null, 'default', 0, 'dev/static/sign', 0);

and proceed below commands from your root directory

php -dmemory_limit=1G bin/magento setup:upgrade
php -dmemory_limit=1G bin/magento setup:di:compile
php -dmemory_limit=1G bin/magento setup:static-content:deploy -f
php bin/magento cache:clean
chmod -R 777 var/ pub/ generated/

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.