Reputation: 215
I have .php file called mytasks.php
which essentially does some background tasks. It is not meant to be opened by the public. Its just suppose to do its own thing, and if people keep opening it, it could be a serious issue for me (server overload).
So how can I make sure no one visits www.example.com/mytask.php
. Is there a way I can block people from opening this URL?
Upvotes: 0
Views: 1804
Reputation: 549
Basically when you are creating a website your application consists of two major directories.
I guess you have ftp access to the server and you should put your private PHP script outside the public directory.
Upvotes: 3
Reputation: 2204
You can block a file with apache/nginx
If you're using apache, add this to your .htaccess file:
<Files "mytasks.php">
Order Deny,Allow
Deny from all
</Files>
Or in nginx:
location ^~ /mytasks.php {
return 404;
}
Upvotes: 2