Categories

htaccess: allow access control from subdomains

When having an application running on the top domain of your site you may want to allow subdomains to make ajax requests to the top domain. If that is the case, and if you do not know which subdomain will be making the request, you should consider adding the following rule to you .htaccess file in your top domain:

?View Code APACHE
SetEnvIf Origin "^(.*\.(appcropolis|simplifysites|localhost.+)\.com)$" ORIGIN_SUB_DOMAIN=$1
Header set Access-Control-Allow-Origin "%{ORIGIN_SUB_DOMAIN}e" env=ORIGIN_SUB_DOMAIN

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

IMPORTANT! To be able to proceed, you need to solve the following simple math (so I know that you are a human) :-)

What is 4 + 14 ?
Please leave these two fields as-is: