Website URL
Would make problems worse lol
Error Message
Other Information
Hi guys, how to block all IP addresses from accessing my site except one (mine) with .htaccess
file?
Would make problems worse lol
Hi guys, how to block all IP addresses from accessing my site except one (mine) with .htaccess
file?
hey there, try this.
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REMOTE_ADDR} !=yourrip
RewriteRule ^ - [F,L]
</IfModule>
This approach is quite tedious
because your IP changes (it’s dynamic) usually every 24 hours
and you have to edit the .htaccess file every time.
So you would be better off using Protected Directories
(see CA) on the root instead…In which you will choose a user/password which needs to be entered before your website can be accessed (more precisely disk space) and then you can always tell your browser to remember your access data and not have to enter them again.
A simpler .htaccess directive is just to use this line:
Require ip 999.999.999.999
If you need to allow more than one IP, you can just add them at the end of this line, like:
Require ip 888.888.888.888 999.999.999.999
With the side notes that: