Help me with .htaccess please

Hello, how do I configure the .htaccess file so I allow access control?
I have a .JSON file which I want to fetch, but I’m getting this error in console:
TypeError: “NetworkError when attempting to fetch resource.” [debugger eval code:5:25](chrome://devtools/content/webconsole/debugger eval code)

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at (Reason: CORS header ‘Access-Control-Allow-Origin’ missing).

Put these into .htaccess file:

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

Edit: I used to do hotlinks from my site by discord.js and not discord itself. Some sites are not able to access this security system. Google is allowed.

1 Like

Try to use this code on your .htaccess file:

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

Also, create an .htaccess file on your htdocs folder, don’t use the one on the / folder!

And read this article if you have problems integrating the JSON on your other website:


AJAX and file downloads from other websites are blocked on the server level. You can try to make your website return different CORS headers, but the server will prevent them from actually being executed.

Also, looking at your domain name, I would like to remind you that InfinityFree is a website hosting service. That means we provide hosting for websites which are viewed in browsers. We don’t provide a free file sharing or file distribution service.


Sorry for the late reply, my account was put on hold for some reason…

Looks like I will need to find another way to read my JSON file, because I cant make it work with the .htaccess settings posted here.

Also I created a basic html page, so I no longer use infinityfree as a file hosting service, thanks for letting me know about that, Admin

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.