CATEGORIES

TAGS

SSL

PostgreSQL

cPanel

email

Error

WHM

Linux

Bash

Debian

Ubuntu

How can I allow or deny access to my site with .htaccess file

29th August
Linux
How can I allow or deny access to my site with .htaccess file

Via .htaccess file, you can allow or deny access to your site not only the certain user but also, group of users, users depended on their country, or you can allow/deny access to your file on a specific time during the day, you are allowed to allow/deny access from some IP addresses.

Let’s see some examples. How to deny access to your site from all sources expect which you want.

You just need to add these lines in the top of your .htaccess file:

Copied!

Allow from 192.168.0.100

Deny from all



After configuration .htaccess file doesn’t forget to save it. Via these two lines now to your site can connect only the user with this IP “192.168.0.100”.

And in these way you can deny access to some files from all sources expect which you want.

Copied!

<FilesMatch “\.html$”>
Allow from 192.168.0.100
Deny from all
</FilesMatch>



Instead of .html, in the first line you can gave some other extension. But not only this functions can fulfill .htaccess file. To know about other functions you can read our articles about .htaccess.


SUBSCRIBE by email and never miss a post!