0

I made a web application from localhost and now im planning to put it online but after uploading my web application i got error in my console that says: No 'Access-Control-Allow-Origin' header is present on the requested resource.

My ajax scripts are notwrking.

I cant even register and login in my web application now. How to fix this?

  • did you read the error message? it probably mentions something about a same-origin policy. – Kevin B Aug 03 '14 at 19:37
  • Simply, it means that you are trying to do cross-domain requests; obviously without configuring things on your server or client, depending on what the script should do. Update your question with some more information and maybe we could help you. – hex494D49 Aug 03 '14 at 19:50
  • possible duplicate of [Origin is not allowed by Access-Control-Allow-Origin](http://stackoverflow.com/questions/10143093/origin-is-not-allowed-by-access-control-allow-origin) – Boann Aug 04 '14 at 02:03

1 Answers1

2

You have to go inside your .htaccess file in your server's root and add this line to allow cross-domain requests:

Header set Access-Control-Allow-Origin "*"

If no .htaccess file exists on your server then just create it.

Marco Bonelli
  • 63,369
  • 21
  • 118
  • 128