2

I have installed Magento 2.2.8 in Xampp. After installed and done all the necessary things, I have checked the site in frontend but it seems the CSS is not loaded correctly. Please see the screenshot

enter image description here

In the Network tab, I'm getting these:

enter image description here

Could anyone please help me to resolve this issue?

Siva
  • 1,120
  • 1
  • 14
  • 33

1 Answers1

0

You can give this a try, edit isPathInDirectories method with below code:

protected function isPathInDirectories($path, $directories)
    {
        if (!is_array($directories)) {
            $directories = (array)$directories;
        }
        foreach ($directories as $directory) {
            if (0 === strpos(str_replace('\\', '/',$this->fileDriver->getRealPath($path)), $directory)) {
                return true;
            }
        }
        return false;
    }

Note: don't forget to redeploy static contents and run di:compile command

fmsthird
  • 4,592
  • 4
  • 17
  • 41
  • I haven't tested it but as you mentioned in the comment above, I think the above solution will work. – fmsthird May 14 '19 at 06:42
  • I have tried but it's not working as expected! – Siva May 14 '19 at 06:54
  • how'd you do it? You should first run php bin/magento setup:static-content:deploy -f --area frontend then edit the Validator file. Save then run php bin/magento setup:di:compile – fmsthird May 14 '19 at 06:56
  • because the error seems to be caused by undeployed static files as mentioned in the comment above, you should check pub/static/frontend folder if static contents has been generated after running command for deploy static view files – fmsthird May 14 '19 at 06:58
  • Otherwise, you have to re-run again the static deploy command until you see the files are deployed in pub/static folder – fmsthird May 14 '19 at 07:00
  • and of course. don't forget to flush cache – fmsthird May 14 '19 at 07:03
  • 1
    Let me try and update you. Thanks for the steps – Siva May 14 '19 at 07:07
  • @Siva sure let me know if it works – fmsthird May 16 '19 at 08:45
  • Still not working. So finally I have reinstalled the Magento2.2.8 in local. Anyway thanks for following up. – Siva May 16 '19 at 08:47