Before closing this as duplicate, please know that I read many similar questions on SO and none of them answers my doubt.
I am trying to call my .php file using jQuery.get()
$.ajax({
url: url,
data: data,
success: success,
dataType: dataType
});
I am using wordpress and the javascript code from where I am trying to call the php file is included in the page's header.
I put the php file in a my-includes folder in the root of server, so I can access it using url:/my-includes/xxx.php . (thanks go to OSDM for his answer)
But now it is publically accessible using domain-name/my-includes/xxx.php
My question is-
Is this how websites work. Isn't this a security risk?
can I make this file inaccessible to general public yet keep it working for my site?