Skip to content

Json file gives 403 error on server

I have a json file contianing data which I access through javascript. On my virtual MAMP server on mac It works, but on my online server when I load the HTML file I cant access the json file from javascript. I get 403 no permission for access error. Why?

Answer

If your production server is Linux based then please consider these:

  1. please check the directory your file is inside. There must be a .htaccess file there, which contains settings regarding directory access. If this is the case, you’ll have to either move the json file out of that directory, or disable the .htaccess settings in question.

  2. Also, in some cases, you get this error when the file is unreadable for any reason:

    a. file system errors – run fsck;

    b. check file permissions, the file should have at least 644 [rw-r--r--], the directory the json file is inside of, should have at least 755 [rwxr-xr-x] ),