Not sure what i'm doing wrong in my htaccess or so, but when I access my website from http://example.org
instead of http://www.example.org
it throws this error:
No 'Access-Control-Allow-Origin' header is present on the requested resource.
Origin 'http://example.org' is therefore not allowed access.
how do i setup my htaccess or my server apache to avoid this problem?
www.example.com
and example.com
are different origins. To be the same origin, the complete hostname, the port and the scheme have to match.
You have three options:
The last approach is probably the best.