{"id":943,"date":"2022-06-21T09:38:18","date_gmt":"2022-06-21T09:38:18","guid":{"rendered":"https:\/\/blog.hostinger.io\/support\/2022\/06\/21\/6320787-is-cors-supported-at-hostinger\/"},"modified":"2022-06-21T09:38:18","modified_gmt":"2022-06-21T09:38:18","slug":"6320787-is-cors-supported-at-hostinger","status":"publish","type":"post","link":"https:\/\/www.hostinger.com\/support\/6320787-is-cors-supported-at-hostinger\/","title":{"rendered":"Is CORS Supported at Hostinger?"},"content":{"rendered":"<p class=\"no-margin\">You can use Cross-Origin Resource Sharing (CORS) on all of our Web, WordPress and Cloud hosting plans!<\/p><p class=\"no-margin\">\n<\/p><p class=\"no-margin\">Just add the following lines to your website&rsquo;s <b>.htaccess file<\/b>:<\/p><p class=\"no-margin\">\n<\/p><pre><code>&lt;IfModule mod_headers.c&gt;<br>Header set Access-Control-Allow-Origin \"*\"<br>&lt;\/IfModule&gt;<\/code><\/pre><p class=\"no-margin\">\n<\/p><p class=\"no-margin\">If you don&rsquo;t have an .htaccess file, you can easily <b><a href=\"\/support\/1583307-how-to-create-an-htaccess-file\" target=\"_blank\" class=\"intercom-content-link\">create one<\/a><\/b> and then add the lines to start using CORS.<\/p><p class=\"no-margin\">\n<\/p><p class=\"no-margin\">In case you want to define the cross-origin headers in a <b>PHP file<\/b>, use the following code:<\/p><p class=\"no-margin\">\n<\/p><pre><code>&lt;?php<br>header(\"Access-Control-Allow-Headers: Authorization, Content-Type\");<br>header(\"Access-Control-Allow-Origin: *\");<br>header('content-type: application\/json; charset=utf-8');<br>?&gt;<\/code><\/pre><p class=\"no-margin\">\n<\/p><p class=\"no-margin\"><b>NOTE:<\/b><\/p><ul>\n<li>\n<p class=\"no-margin\">For the resources to load properly, CORS needs to be added to the <b>origin source <\/b><\/p>\n<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Enabling CORS at Hostinger<\/p>\n","protected":false},"author":581,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"include_on_kodee":true,"footnotes":""},"categories":[218],"tags":[],"class_list":["post-943","post","type-post","status-publish","format-standard","hentry","category-supported-technologies-and-functions"],"hreflangs":[{"locale":"en-US","link":"https:\/\/www.hostinger.com\/support\/6320787-is-cors-supported-at-hostinger\/","default":1},{"locale":"fr-FR","link":"https:\/\/www.hostinger.com\/fr\/support\/6320787-cors-est-il-pris-en-charge-chez-hostinger\/","default":0},{"locale":"id-ID","link":"https:\/\/www.hostinger.com\/id\/support\/6320787-apakah-cors-didukung-di-hostinger\/","default":0},{"locale":"pt-PT","link":"https:\/\/www.hostinger.com\/br\/support\/6320787-o-cors-e-compativel-com-a-hostinger\/","default":0},{"locale":"uk-UA","link":"https:\/\/www.hostinger.com\/ua\/support\/6320787---cors--hostinger\/","default":0}],"include_on_kodee":true,"_links":{"self":[{"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/posts\/943","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/users\/581"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/comments?post=943"}],"version-history":[{"count":0,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/posts\/943\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/media?parent=943"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/categories?post=943"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hostinger.com\/support\/wp-json\/wp\/v2\/tags?post=943"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}