{"id":12444,"date":"2025-04-22T18:00:00","date_gmt":"2025-04-22T12:30:00","guid":{"rendered":"https:\/\/meetanshi.com\/blog\/?p=12444"},"modified":"2025-04-22T18:06:42","modified_gmt":"2025-04-22T12:36:42","slug":"403-forbidden-issue-errors-on-wysiwyg-image-previews","status":"publish","type":"post","link":"https:\/\/meetanshi.com\/blog\/403-forbidden-issue-errors-on-wysiwyg-image-previews\/","title":{"rendered":"Unable to display WYSIWYG images (403 forbidden issue) on Apache\/nginx: Solution\u00a0"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">In Magento 2, 403 forbidden issue typically arrives when trying to display WYSIWYG images that means that the webserver &#8211; nginx\/apache is denying access to the images.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">When you go to Magento admin editor i.e: CMS page or block, you see an image inserted via WYSIWYG shows a broken link.&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If you right click on it and open in a new tab, the URL will show a 403 forbidden issue.&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u200bAlso, when you try to open the WYSIWYG editor and attempt to add an image, numerous 403 forbidden errors appear in the console.\u200b<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">While there are several factors that are unable to display WYSIWYG images 403 forbidden issues.&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Some of the common ones are:&nbsp;<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>the web servers can not read such WYSIWYG image files\/folder\u00a0<\/li>\n\n\n\n<li>permission for the images are incorrect\u00a0<\/li>\n\n\n\n<li>.htaccess\/nginx rules are blocking access\u00a0<\/li>\n\n\n\n<li>due to file ownership issues<br><\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">Now, consider following the solution in this article to resolve it.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Unable to display WYSIWYG images(403 forbidden issue)<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u200bIn most cases, this issue arises due to Nginx and Apache configurations. Implementing the changes outlined below can help resolve it.\u200b<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">For NGINX :<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Find the below code in the NGINX configuration:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\"># such as .htaccess, .htpasswd, etc...\nlocation ~ \/\\. {\n    deny all;\n    access_log off;\n    log_not_found off;\n}\n<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Replace it with the code below:<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">location  \/. { ## Disable .htaccess and other hidden files\n    return 404;\n}\n<\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">For Apache:<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Find the below code:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&lt;DirectoryMatch &#8220;^\\.|\\\/\\.&#8221;&gt;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&nbsp;&nbsp;&nbsp;&nbsp;Order allow,deny<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&nbsp;&nbsp;&nbsp;&nbsp;Deny from all<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&lt;\/DirectoryMatch&gt;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">You will need to allow access to which directory\/folder is not accessible.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&lt;DirectoryMatch &#8220;^\\.|\\\/\\.&#8221;&gt;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&nbsp;&nbsp;&nbsp;&nbsp;Order allow,deny<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&nbsp;&nbsp;&nbsp;&nbsp;Deny from all<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&lt;\/DirectoryMatch&gt;<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>The above code means deny all the directories starting with dot.\u00a0<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">&lt;DirectoryMatch &#8220;\/.OtherDirName&#8221;&gt;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&nbsp;&nbsp;&nbsp;&nbsp;Order allow,deny<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&nbsp;&nbsp;&nbsp;&nbsp;Allow from all<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">&lt;\/DirectoryMatch&gt;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Here, instead of OtherDirName &#8211; add the directory for which you need to allow access. I.e: .thumb<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u200bThat\u2019s all.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Implementing this change resolved the issue for you.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In Magento 2, 403 forbidden issue typically arrives when trying to display WYSIWYG images that means that the webserver &#8211; nginx\/apache is denying access to&#8230;<\/p>\n","protected":false},"author":5,"featured_media":12448,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[34],"tags":[],"class_list":["post-12444","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-magento"],"acf":[],"_links":{"self":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/12444","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/comments?post=12444"}],"version-history":[{"count":1,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/12444\/revisions"}],"predecessor-version":[{"id":12445,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/posts\/12444\/revisions\/12445"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/media\/12448"}],"wp:attachment":[{"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/media?parent=12444"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/categories?post=12444"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/meetanshi.com\/blog\/wp-json\/wp\/v2\/tags?post=12444"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}