Allowing Cross Origin Requests using htaccess

Posted on 29-03-2017 by Nadir Latif


htaccess directives can be used to allow requests from different domains. For example the following directives added to htaccess file should allow access from any domain:

Header add Access-Control-Allow-Origin "*"
Header add Access-Control-Allow-Headers "origin, x-requested-with, content-type"
Header add Access-Control-Allow-Methods "PUT, GET, POST, DELETE, OPTIONS"

Leave a Comment: