17

I've just installed Magento 2 onto my production server under a development. subdomain. The install appeared to have been successful but I've noticed there are no images or working javascript in both the frontend and the backend.

After inspecting the source code, I found that files being called in such as http://dev.website.com/pub/static/frontend/Magento/luma/en_GB/css/print.css don't actually exist. Any thoughts? I tried solutions on several stacks but haven't had any luck.

Magento 2

Magento 2

1

5 Answers 5

26

Try this Before that take Backup

Remove everything, except .htaccess file from pub/static folder

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

Note: Remove entire files and folder under pub/static except .htaccess file.

For More info ref this http://www.dckap.com/blog/magento-2-admin-links-not-working-in-windows/

9
  • Also, make sure you enabled Apache server rewrites. Commented Jan 7, 2016 at 14:59
  • This has fixed the frontend of my website. Images and styling is now also appearing in the backend, however - none of the links work. I'm getting loads of errors for missing files in pub/static - most of which don't exist. Commented Jan 7, 2016 at 17:43
  • i can't get.....
    – Magento 2
    Commented Jan 7, 2016 at 17:48
  • Fixed! I had to change the permissions of all directories in pub/static, as they were incorrect. Commented Jan 7, 2016 at 18:03
  • 1
    This is an accepted answer recommending modifying a core file. This is wrong and no one should do this.
    – mbalparda
    Commented May 23, 2016 at 12:47
17

You can run below command from magento root folder.

php bin/magento setup:static-content:deploy

This will download the content perfectly in respective folders.

1
  • 1
    This should be accepted website
    – linuxeasy
    Commented Jul 3, 2016 at 16:34
3

If you are in default or development mode use -f to forcefully download static content. In development mode static content are downloaded automatically.

php bin/magento setup:static-content:deploy -f
1
  • when i try for this my localhost, i am getting RunTimeEXception Error..
    – zus
    Commented Nov 21, 2017 at 6:49
2

If you see that Magento is trying to load from a folder other than en_US, you can try to deploy static content in the appropriate folder as below

bin/magento setup:static-content:deploy en_GB en_AU
1

I had the same issue after installing magento 2.1.1 and followed the steps mentioned below

  1. Add D:\xampp\php to your PATH Environment Variable. Then Close The Command Prompt And Restart Again. Its important because if you didn't restart you command prompt then changes will not reflect.

Follow this link for guidance on adding path variable: https://www.java.com/en/download/help/path.xml

  1. Navigate to your mangento root directory (Eg: D:/xampp/mangento/) through command prompt

  2. Run the command php bin/magento setup:static-content:deploy

This worked for me. Hope it helps others!

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.