Protect your website from EVERYONE except…

Deny access to EVERYONE except defined users. Users defined by their IP addresses.

You can place the .htaccess file in your "root" directory or in any other sub-directory to influence how that directory behaves upon a request

.htaccess


<RequireAny>

Require ip 92.00.000.000

</RequireAny>


The above code only lets a user with the IP address of 92.00.000.000 view the website or directory where this .htaccess file is placed

How do I comment out .htaccess code?

Use the hash symbol #
Comments have to appear on one line. Each new line of comments must start with #
Now everything preceded with a hash symbol will be ignored. They are just notes for you to refer to.



<RequireAny>

#Only the users with the following IP addresses below will be allowed to view 
#this directory

Require ip 92.00.000.000
Require ip 101.55.96.172
Require ip 16.45.124.111

</RequireAny>


Any user without a required IP address will be re-directed to the 403 Forbidden Error page.
See Personalise your Error pages for a full list of Error pages.

Create your own 403 Forbidden Error page

Create your own html web page and call it "forbid.html"
Remember to save this file outside of the directory the .htaccess file is located otherwise this too will be forbidden.

Now add "ErrorDocument 403 https://www.yourwebsite.co.uk/errors/forbid.html". See below…



ErrorDocument 403 https://www.yourwebsite.co.uk/errors/forbid.html

<RequireAny>

#Only the users with the following IP addresses below will be allowed to view 
#the contents of this directory

Require ip 92.00.000.000
Require ip 101.55.96.172
Require ip 16.45.124.111

</RequireAny>


Any user without a required IP address will be re-directed to YOUR NEW CUSTOM 403 Forbidden Error page.
See Personalise your Error pages for a full list of Error pages.

 

 

Please share if you find the content useful - thank you

Master Template World

Contact

Master Template Forum Robot

FORUM

Have a comment or something to say?
Say it here…

[privacy policy]