How to fix Cross-Origin Request Blocked with the .htaccess file

If you notice something like this in the browser console: Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://test.democlient.tld/index.php?route=common/currency/getIpInfo/&userIP=18.73.1.33

(Reason: CORS header ‘Access-Control-Allow-Origin’ missing).

Then using the .htaccess fix will solve this issue with the following code:

# CORS
Header set Access-Control-Allow-Origin "https://phpcmsmodx.info"

.htaccess also allows some security tweaks like making the default controller file to be not the default one. Here is how the code can be written:

DirectoryIndex index-main.php index.php
Check more details about the hardening MODX website practice



Rate this information:
  • Currently0/5 Stars
  • 1
  • 2
  • 3
  • 4
  • 5
Votes: 0

May we recommend:
Fixing WebSite Responsiveness  Ajax  Build you own product and order in opencart  ModX books store (for private users + subscribers)  

MODX CMS extensions Sale:

4h support  3h support  build your product in opencart  import products into opencart  


Modx Extras for advanced content