Skip to main content
Is CORS Supported at Hostinger?

Enabling CORS at Hostinger

Updated over a year ago

You can use Cross-Origin Resource Sharing (CORS) on all of our Web, WordPress and Cloud hosting plans!

Just add the following lines to your website's .htaccess file:

<IfModule mod_headers.c>
Header set Access-Control-Allow-Origin "*"
</IfModule>

If you don't have an .htaccess file, you can easily create one and then add the lines to start using CORS.

In case you want to define the cross-origin headers in a PHP file, use the following code:

<?php
header("Access-Control-Allow-Headers: Authorization, Content-Type");
header("Access-Control-Allow-Origin: *");
header('content-type: application/json; charset=utf-8');
?>

NOTE:

  • For the resources to load properly, CORS needs to be added to the origin source

Did this answer your question?