Error filtering template: Unable to write file into directory /E:/xampp/htdocs/magento216/pub/media/catalog/product/cache/f073062f50e48eb0f0998593e568d857/m/b. Access forbidden.

Description: After installation of magento 2 with sample data, If you see above error then you can solve this issue with following way.

Go to your project directory : in vendor/magento/module-catalog/Model/View/Asset/Image.php file and replace all occurrences of DIRECTORY_SEPARATOR with ‘/’.

The second is edit the getRelativePath function to look like:

private function getRelativePath($result)
{
    $prefix = $result == '/' ? $result : '';
    $result = $this->join($result, $this->getModule());
    $result = $this->join($result, $this->getMiscPath());
    $result = $this->join($result, $this->getFilePath());
    return $prefix . $result;
}

 

Advertisements